Re: Changing the background color of a Label



>I'm imagining simply a label with a background color (usually Grey) and a
>foreground color (the color of the writing usually black). But I want to
>change this! I've managed to change the foreground color to white but didn't
>manage to change the background to green using GtkStyle under Gtk-1.2.
>Any help would be greatly appreciate :-)

labels don't have a background color. they are just pieces of text
that are drawn over something else.

if you want to control the bg color, you need to add the label to a
container widget that has a window. a GtkEventBox is the typical
choice. you can then control its bg and fg color and the label will
follow.

also, please don't set colors in source code. use an RC file so that
users can change them as they wish using a standard mechanism. there
is information on how to do this in the GTK+ FAQ.

--p



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