Re: Themes and colours




On Oct 15, 2006, at 8:03 PM, Daniel Kasak wrote:

I've been reading a bit on Gtk2::Widget->get_default_style and
Gtk2::Style, but I'm not sure if I can do what I want to do. Here's
what I want to do ...

- find out what default colour a cell's text will be, according to the
current Gtk2 theme ( most important )

- find out what colour a cell's text will be when the row is selected
( helps me to decide what text colours might be appropriate )

- find out what colours a cell's background alternates between when
'rules hinting' is on ( less important )

Is this stuff possible?

You can read the gtk+ source and find the answers, but they're probably not guaranteed.

In general:

- the text color will come from the TreeView's style's "text" color; the state is determined by mapping the cell renderer's state into the GtkWidgetState enumeration values.

- the background color is from the TreeView's style's "base" color. again, the state is determined by mapping the renderer's state. "selected" is most important here.

- the treeview sets up the "cell_odd_ruled" etc detail for GtkStyle when drawing a ruled view. the default implementation uses a custom function to "darken" the base color (using a trivial scaling of luminance and saturation in the HLS colorspace) by some initially non- obvious rules. the upshot is that i think this is entirely theme- dependent, and there appears to be no way to query it. if you *really* need the color, you may have to resort to screen-scraping.

--
"Ghostbusters" is the best movie of this decade.
  -- Neal, circa 1996, referring to a movie released in 1984.




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