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 740910 - allow rgba color definitions in style schemes
allow rgba color definitions in style schemes
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
git master
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-30 01:43 UTC by Christian Hergert
Modified: 2015-08-16 16:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add support for rgba color definitions (1.68 KB, patch)
2014-11-30 01:44 UTC, Christian Hergert
needs-work Details | Review

Description Christian Hergert 2014-11-30 01:43:10 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.
Comment 1 Christian Hergert 2014-11-30 01:44:03 UTC
Created attachment 291812 [details] [review]
add support for rgba color definitions
Comment 2 Sébastien Wilmet 2014-11-30 10:52:43 UTC
It's not documented, but #rgb(...) and #rgba(...) already work, with the # prefixed.
Comment 3 Christian Hergert 2014-12-01 01:20:47 UTC
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
Comment 4 Sébastien Wilmet 2014-12-01 18:42:39 UTC
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?
Comment 5 Christian Hergert 2014-12-22 23:12:34 UTC
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.
Comment 6 Sébastien Wilmet 2014-12-23 11:12:13 UTC
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.
Comment 7 Paolo Borelli 2015-08-16 16:30:05 UTC
I fixed this and added a unit test