GTK extends the CSS syntax for images and also uses it for specifying icons. To load a themed icon, use
-gtk-icontheme(Name)
The specified icon name is used to look up a themed icon, while taking into account the values of the -gtk-icon-palette property. This kind of image is mainly used as value of the -gtk-icon-source property.
Symbolic icons from the icon theme are recolored according to the -gtk-icon-palette property, which defines a list of named colors. The recognized names for colors in symbolic icons are error, warning and success. The default palette maps these three names to symbolic colors with the names error_color
, warning_color
and success_color
respectively. The syntax for defining a custom palette is a comma-separated list of name-color pairs, e.g.
success blue, warning fc3, error magenta
Recoloring is sometimes needed for images that are not part of an icon theme, and the
-gtk-recolor(uri, palette)
syntax makes this available. -gtk-recolor requires a url as first argument. The remaining arguments specify the color palette to use. If the palette is not explicitly specified, the current value of the -gtk-icon-palette property is used.
GTK supports scaled rendering on hi-resolution displays. This works best if images can specify normal and hi-resolution variants. From CSS, this can be done with
-gtk-scaled(Image1, Image2)
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/ch39s03.html