Changing color



I use the following to change the color of some important entries in a 
GtkCList:


	redstyle = gtk_style_copy(GTK_WIDGET(groups)->style);
	GdkColor mycolor;
	mycolor.red =   255 <<8;
	mycolor.green =   0 <<8;
	mycolor.blue =    0 <<8;
	redstyle->fg[GTK_STATE_NORMAL] = mycolor;
	mycolor.red =   255 <<8;
	mycolor.green = 255 <<8;
	mycolor.blue =    0 <<8;
	redstyle->fg[GTK_STATE_SELECTED] = mycolor;

	// ...

	GtkStyle *numberstyle;
	if (g->uniconify)
		numberstyle = redstyle;
	else
		numberstyle = gtk_clist_get_cell_style(groups, row, 1);
	gtk_clist_set_cell_style(groups, row, 0, numberstyle);


My problem is in making this themes aware! While I was not using any
theme it was working all right but now the cells that I change get the 
default (non-themed) colors for everything but the two colors I
specified above. I do not quite understand this since I would have
thought that the gtk_style_copy() call would have copied the relevant
information.

Also - how do I pick the "right" color to highlight certain entries?
With the default color scheme the above two colors are okay, but if
the theme changes the background then they might not be easily
visible.

I guess these two questions are related - if I change the foreground I
must also change the background in order to ensure that the text is
visible.

But how can I do that and still keep within the color scheme laid out
by the theme? Is there some gtk_make_highlight_color() function that I 
should know about?

I hope I have made myself somewhat clear :-). Thanks for any help!

-- 
Mvh. Anders



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