After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 633762 - Correctly convert colors to CSS and deal with librsvg limitations
Correctly convert colors to CSS and deal with librsvg limitations
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
2.91.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-11-02 00:54 UTC by Owen Taylor
Modified: 2010-11-03 17:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Correctly convert colors to CSS and deal with librsvg limitations (2.41 KB, patch)
2010-11-02 00:55 UTC, Owen Taylor
none Details | Review
Switch to CSS interpretation of rgb() and rgba() colors (7.38 KB, patch)
2010-11-02 19:41 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-11-02 00:54:44 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.
Comment 1 Owen Taylor 2010-11-02 00:55:31 UTC
Created attachment 173663 [details] [review]
Correctly convert colors to CSS and deal with librsvg limitations
Comment 2 Matthias Clasen 2010-11-02 01:07:26 UTC
We should probably just fix GdkRGBA to use exactly the same serialization as css3
Comment 3 Owen Taylor 2010-11-02 19:41:26 UTC
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.
Comment 4 Carlos Garnacho 2010-11-02 23:18:19 UTC
The patch looks right to me, things look like they should have been right from the start
Comment 5 Owen Taylor 2010-11-03 17:44:09 UTC
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.)