Supporting RGBA Hex color codes
pango_color_parse
used in gdk_rgba_parse
doesn't currently support RGBA hex notation that can be found in CSS for instance. I'm talking about color codes such as #RGBA
or #RRGGBBAA
.
Those notations are explained here: https://www.w3.org/TR/css-color-4/#hex-notation
They are the 4-digits and 8-digits hex notations.
That kind of color notation is already supported by firefox for instance.
This can create issues when trying to import CSS styles that were made without knowing this limitation. Currently, the applications could crash if reading such values with the error GLib.Error: gtk-css-provider-error-quark: <data>:4:20Junk at end of value for background (1)
.
The support could be implemented either by:
- Adding alpha channel in
PangoColor
and supporting RGBA Hex color codes inpango_color_parse
- Dropping the use of
PangoColor
ingdk_rgba_parse
altogether and parsing hex codes from scratch - Counting the number of characters and then reading and truncating the alpha value so that we can then use
pango_color_parse
and set the proper alpha value
Edited by Tim Krief