[pygtk] [GTK3] get background color

Osmo Salomaa otsaloma at iki.fi
Fri Aug 2 08:57:28 WST 2013


01.08.2013 10:09, Yann Leboulanger wrote:
> On 08/01/2013 02:00 AM, Osmo Salomaa wrote:
> style.lookup_color("theme_base_color") returns a 0, 0, 0, 0 color here.

OK, so that's theme-specific.

Some color names might be available regardless of theme, but I don't 
know which ones; for example Gtk.InfoBar documentation explicitly 
mentions {info,warning,question,other}_{bg,fg}_color.

I get the same (0,0,0,0) from get_background_color with your test 
script. I've ran into this issue before and I have just used those 
Adwaita names and a not-well-thought-out fallback if the lookup fails.

Curiously, if I swap the text view in your script for an entry, I get 
the actual background color (white). In any reasonable theme, these 
should probably both use the "base" color.

-- 
Osmo Salomaa <otsaloma at iki.fi>


More information about the pygtk mailing list