Themes and colours



Hi all.

I use colours to highlight data - usually in treeviews. I realise that
this is somewhat frowned upon with themable toolkits, but on
the other hand this is a requirement from our users, and does
make data a lot easier to interpret with a quick glance.

For example, I use $treeview_column->set_cell_data_func to highlight
negative values in red:

if ( $value < 0 ) {
   $renderer->set( foreground  => "red" );
} else {
   $renderer->set( foreground  => "black" );
}

With most themes, this is OK, but with some of the darker themes
( which are my favourite ), the black text is unreadable. I need to be
able to find out what colours a theme is using - mainly in treeviews.

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?

Dan




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