GNOME Bugzilla – Bug 413941
Add support for RGBA colors in Pango for opacity styling
Last modified: 2015-08-15 03:00:00 UTC
Hold the WONTFIX button for a second, please... :) Very frequently do applications have a desire to subdue some text, somewhat. Unfortunately, they resort to using some flat colours taken from the theme or whatever to do this. See the example with Gossip. The status message text colour is taken from an arbitrary symbolic in the active Gtk theme, but it reverts to the normal foreground colour when you highlight a row. As you can see in the screenshot, there is some visual inconsistency here, as the status message is no longer in a subdued colour. I think sticking with foreground colour and just modulating the transparency somewhat would provide better looking results. If Pango had support for RGBA colours rather than just RGB as we have right now, this would be a piece of cake and would save us having to resort to using Cairo directly. What do you think?
Created attachment 83746 [details] Screenshot example
Created attachment 83831 [details] Before
Created attachment 83833 [details] After (mockup)
Would be nice, yeah. Problem is that PangoColor is public, with no padding. So we can't do without introducing another type. Probably easier to add a new attribute for alpha only.
OK, well can we do that now then, with the intention of tidying this up next ABI+API break? I'm really keen to start harnessing opacity rather than resorting to unreliable colour maths!
PangoAttrOpacity is the way to go then.
We can hack pango markup to accept things like #ffffff88 that add both a color and an opacity attribute, but it may be simpler to just add an opacity attribute to the span tag. Humm, the problem with adding opacity instead of making colors support alpha is that we have multiple colors: foreground, underline, background. Which ones should the opacity attribute modify?
foreground and underline, not background.
*** Bug 506890 has been marked as a duplicate of this bug. ***
Behdad, can we resurrect this discussion? Are we in a position to implement this?
Not sure. I'll get back to it when I'm back from vacation...
Ultimately I think having all colours be RGBA is the best way. So when can we break ABI for PangoColor?
No. I have some plans to allow type inheritance in the attributes. That may help.