GNOME Bugzilla – Bug 633762
Correctly convert colors to CSS and deal with librsvg limitations
Last modified: 2010-11-03 17:44:11 UTC
The GdkRGBA format seems like it was designed with the idea that it would have a CSS-compatible string serialization, however GdkRGBA uses rgba(0.5, 0.5, 0.5, 0.75) for what is rgba(128, 128, 128, 0.75) in CSS3, so we need to do our own conversion when generating an actual color to be parsed by CSS. Furthermore, librsvg doesn't actually support CSS3 rgba colors, so just drop the alpha channel. It might be possible to emulate an alpha channel using an extra fill-opacity property in the generated CSS, but using symbolic colors with an alpha channel seems unusual.
Created attachment 173663 [details] [review] Correctly convert colors to CSS and deal with librsvg limitations
We should probably just fix GdkRGBA to use exactly the same serialization as css3
Created attachment 173710 [details] [review] Switch to CSS interpretation of rgb() and rgba() colors Here's a patch that takes the approach of switching over the syntax for GdkRGBA. The accomodation to the limitations of librsvg is that if a color has no opacity gdka_rgb_to_string() generates a rgb() color instead of a rgba() color. If you use a color with opacity for a symbolic color, it is then between you and the maintainers of librsvg to make it to work.
The patch looks right to me, things look like they should have been right from the start
Attachment 173710 [details] pushed as 5daab52 - Switch to CSS interpretation of rgb() and rgba() colors (I'm taking Carlos's comment as an ok-to-commit. If not, let me know.)