GNOME Bugzilla – Bug 740910
allow rgba color definitions in style schemes
Last modified: 2015-08-16 16:30:05 UTC
I have a use case where I want to have a translucent background for a style in my style scheme. Probably not useful for everyone since only Builder has background grid lines right now, but useful to allow me to have the grid lines show through. this adds the support for color="rgba(.1,.1,.1,.1)" in the style definition.
Created attachment 291812 [details] [review] add support for rgba color definitions
It's not documented, but #rgb(...) and #rgba(...) already work, with the # prefixed.
This doesn't seem to work for me: I tried: <color name="foo" value="#rgb(.5,.5,.5)"/> <color name="foo" value="#rgba(.5,.5,.5,.5)"/> <color name="foo" value="#rgba(235,202,210,.5)"/> I get the following warning: Don't know color `#rgb(.5,.5,.5)' Don't know color `#rgba(.5,.5,.5,.5)' etc
Replacing the background color like this: <style name="text" foreground="base1" background="#rgba(100,0,0,0.5)"/> works fine (but attention, it's a really ugly theme :p) Maybe ".5" doesn't work but "0.5" does? Or it's because I define the rgba directly in the background property instead of defining a named color?
I should mention that I did get this working by not using the color definitions, and instead using colors directly in the style reference. That meets my needs, feel free to close unless you want to implement it for color too.
I don't plan to work on this any time soon, but we can keep the bug open, it can be useful to define rgba colors. And the rgba support should be better documented.
I fixed this and added a unit test