[pygtk] [GTK3] get background color

Yann Leboulanger asterix at lagaule.org
Thu Aug 1 15:09:54 WST 2013


On 08/01/2013 02:00 AM, Osmo Salomaa wrote:
>> Here is a very simple scrpit that shows the problem. For me it prints:
>> <Gdk.Color(red=0.000000, green=0.000000, blue=0.000000, alpha=0.000000)>
>
> For editable text fields, you're probably looking for the *base* color.
>
>      style.lookup_color("theme_base_color")
>
> For Adwaita, you can find the available color names in gtk-main.css [1],
> but I really don't know if they work across different themes.
>
> [1]
> https://git.gnome.org/browse/gnome-themes-standard/tree/themes/Adwaita/gtk-3.0/gtk-main.css
>

I am under XFCE / GTK2 theme, so there is no such file in my theme. My 
gtkrc file has a base[NORMAL] = "#ffffff" line, but I don't know how to 
get that with gtk3. It should be possible as it's correctly rendered.

style.lookup_color("theme_base_color") returns a 0, 0, 0, 0 color here.

-- 
Yann


More information about the pygtk mailing list