I'm trying to override the background color of a gtk button with vala but it's not working on some themes. So, this code
var b = new Button ();
b.label = "test";
b.margin = 10;
b.override_background_color (Gtk.StateFlags.NORMAL, color (yellow));
look like this on:
Adapta (What I want)
Adwaita
Ambiance
So what am I missing there?
gtk_widget_override_background_color()
is deprecated and no longer used. Use CSS instead:
var css = "* { background: #FFFF00; }";
var p = new Gtk.CssProvider();
try {
p.load_from_data(css, css.length);
b.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (GLib.Error err) {
// handle err
}