Symbolic Icons / SVG Icons that get recoloured
Emmanuele Bassi
ebassi at gmail.com
Wed Mar 20 14:31:24 UTC 2019
On Wed, 20 Mar 2019 at 13:16, David Edmundson <davidedmundson at kde.org>
wrote:
> Turning the list of differences into an actionable TODO list the
> following changes would be needed by both parties to have exact
> feature parity:
>
> GTK changes:
> - Add 2 new CSS classes "bg", and "highlight"
>
What would be the semantics of these two classes?
The main problem is that the re-coloring on icon loading is part of the
public API:
https://developer.gnome.org/gtk3/stable/GtkIconTheme.html#gtk-icon-info-load-symbolic
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gtk/gtkicontheme.h#L316-323
and we cannot change that for GTK 3. For GTK 4 it would be possible to add
more colors, but the API would get pretty busy.
Additionally, we use SVG recoloring as a fallback path, given the cost of
loading SVG icons all over the place, and the optional dependency on
librsvg; we generate pre-sized, recolored variants of the SVG icons
re-encoded as specially crafted PNG files at build time for the assets that
GTK itself ships:
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gtk/encodesymbolic.c
the tool is also installed, so icon theme authors can re-encode their own
symbolic assets.
There's also the added fun that GTK may or may not support SVG assets
depending on whether librsvg is installed. So we may be able recolor
symbolic icons even if they are not actually SVG assets.
- apply SVG CSS injection to include non-symbolic icons. On icons
> that don't end in "-symbolic" we should set the foreground colour on
> the .fg class not to all SVG paths
>
The API for loading non-symbolic assets does not take colors, so we cannot
apply a style class.
In any case, could you open an issue at:
https://gitlab.gnome.org/GNOME/gtk/issues/new
and reference this thread?
Ciao,
Emmanuele.
--
https://www.bassi.io
[@] ebassi [@gmail.com]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20190320/c88a955d/attachment.html>
More information about the xdg
mailing list