Scraping colors from the current Gnome theme

Sorry if I'm asking in the wrong place, but I asked on the PyGTK list and
didn't get much response.

I am trying to write a little script to scrape the color scheme from Gnome
and apply it to Wine.  I thought this would be trivial; reading from one
config file and translating into another, but it hasn't been so easy of a
beginner task.  I found a partial script and have improved on it, but am
stuck with colors that don't make sense to me.

gtk.RcStyle Class Reference says (

    PRELIGHT - A color used for widgets in the
    gtk.STATE_PRELIGHT state. This state
    is the used for gtk.Button and gtk.MenuItem
    widgets that have the mouse cursor over
    them, and for their children.

So PRELIGHT should be the text and background color of a menu item when I
hover over it, right?  In the Raleigh theme, I can use[gtk.STATE_PRELIGHT]
to read the menu hover background color, and it matches what I actually see
(#EAEAEA), so this would seem to be correct.

In the Human theme, though, it's completely different. The menu hover
highlight is yellowish orange, while[gtk.STATE_PRELIGHT]
gives me #F3F0ED, almost white. I don't understand why.

In the Human gtkrc file, there's a bit like this:

  style "ubuntulooks-menu-item" = "ubuntulooks-default"
     xthickness     = 2
     ythickness     = 3
     bg[SELECTED]   = @selected_bg_color
     fg[PRELIGHT]   = @selected_fg_color
     text[PRELIGHT] = @text_color

That "bg[SELECTED]   = @selected_bg_color" is not bg PRELIGHT, but changing
it changes the actual visible hover color, so that must be it, right? "[gtk.STATE_SELECTED]" returns #FFD799, and this is much
closer to the actual highlight color.  (In the top of the gtkrc file,
there's "selected_bg_color:#FFD799", which is where it comes from, I guess.)

But if I try to use this bg[SELECTED] value to get the color for Raleigh, it
gives me a blue, which is not correct.

How do I get the actual color being used by a widget? Not the GTK color it's
theoretically supposed to us, but the color that GTK actually uses to draw
it.  Is this engine-specific?  Is there some other value I can read to get
the colors I actually want?  It seems to me that if I have a menu item
object, and I access[gtk.STATE_PRELIGHT], it should give
me the actual hover (prelight) color of the menu item background.  Why
doesn't it?

Also, is there such a thing as a multiple-document interface in GTK, and if
so, how do I read its background color?

Sorry for all the questions.  :)

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