css: Introduct -gtk-icon-palette

Desktop / GNOME / GTK - Benjamin Otte [redhat.com] - 2 December 2015 17:47 UTC

This borrows heavily from the CSS4 fonts draft's font-palette, currently found at https://drafts.csswg.org/css-fonts-4/#font-palette-control

The palette is mainly meant to trigger invalidations when colors used for symbolic icons change, to potentially allow extending supported colors in symbolic icons and to recolor all colors of a symbolic icon, not just the main one.

The syntax for the property goes like this: Name: -gtk-icon-palette
Value: default | name [ , name ]* Initial: default Applies to: all elements with icons Inherited: yes Animatable: yes, each color animated separately

The property defines a list of named colors to be used when looking up icons. If a name is not defined, the value of the current "color" property is used. Which names are relevant depends on the icons in use. Currently symbolic icons make use of the names "success", "warning" and "error".

"default" is the current behavior of the GTK when coloring symbolic icons and is equal to the string success @success_color, warning @warning_color, error @error_color

Animation is crudely implemented by animating colors that are in both palettes that are animated and otherwise keeping the color from the palette that defined it. Note that this can cause a sharp cut at the beginning or end of the animation when the color goes away and will therefore be replaced with the color property.

You can see an example of animations at http://gfycat.com/CautiousPeacefulIaerismetalmark

7fa37e4 css: Introduct -gtk-icon-palette
gtk/Makefile.am | 2 +
gtk/gtkcsscolorvalue.c | 2 +
gtk/gtkcsspalettevalue.c | 258 +++++++++++++++++++++++++++++++++++++++
gtk/gtkcsspalettevalueprivate.h | 37 ++++++
gtk/gtkcssstylepropertyimpl.c | 18 +++
gtk/gtkcsstypesprivate.h | 1 +
gtk/gtkicontheme.c | 96 +++++++--------
7 files changed, 360 insertions(+), 54 deletions(-)

Upstream: git.gnome.org


  • Share