Re: Getting the Current Theme's Colors



On Thu, 2007-09-20 at 19:39 -0600, Aaron Bockover wrote:
> I'm integrating Lgi, a xlib based application framework, with the Gnome 
> desktop. And I want to be able to make an Lgi application sensitive to 
> the current theme's fonts and colors so that is blends in with the Gnome
> 
> desktop.
> 
> I've worked out how to query for the right system font to use. But I'm 
> having a lot of trouble getting information about how to retrieve the 
> theme's color scheme. I think I need to use gtk_style_lookup_color or 
> maybe the color-hash property of the GtkStyle object. But I can't find 
> any example code and the documentation is too brief. For instance 
> gtk_style_lookup_color has a string parameter "color_name", but 
> absolutely no description of what possible values you might be able to 
> pass into it. The sorts of colors I need are the selection bg/fg color, 
> text fg/bg, application workspace etc.

If your framework uses Xresource, then you can simply add a template
to /etc/gnome/config/ to set X resources based on the current theme.

Otherwise, I think you can read theme colours from XSettings.  You'll
need to look at the gnome-settings-daemon code to see what it exports
over xsettings.

Ross
-- 
Ross Burton                                 mail: ross burtonini com
                                          jabber: ross burtonini com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]