Reputation: 3244
Sorry, I'm newbie in the Gtk, so it is may be the stupid question. I use Gtk+ 3.0 and have this code
GtkWidget *widget;
widget=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start(GTK_BOX(widget), some_label, FALSE, FALSE, 0);
How can I change the background color of the widget? I'm trying that
GdkColor red = {0, 0xffff, 0x0000, 0x0000};
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &red);
and some other examples, but no one of them worked for my case.
Upvotes: 5
Views: 17958
Reputation: 111
In GTK+3 3.22 this markup code inside the text works.
gchar *text = "<b><span font='20' background='#ffffff' foreground='#404040'>I'm a colored label</span></b>";
gtk_label_set_text(GTK_LABEL(label), text);
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
Upvotes: 4
Reputation: 19204
In GTK+ 3.0 you can use gtk_widget_override_background_color
.
Upvotes: 4