aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/util.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/util.vala')
-rw-r--r--main/src/ui/util.vala16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/src/ui/util.vala b/main/src/ui/util.vala
index aad0817d..ec09609a 100644
--- a/main/src/ui/util.vala
+++ b/main/src/ui/util.vala
@@ -74,6 +74,22 @@ public class Util : Object {
if (scale == 0) scale = image.get_scale_factor();
image.set_from_surface(Gdk.cairo_surface_create_from_pixbuf(pixbuf, scale, image.get_window()));
}
+
+ private const string force_background_css = "%s { background-color: %s; }";
+
+ public static void force_background(Gtk.Widget widget, string color, string selector = "*") {
+ var p = new Gtk.CssProvider();
+ try {
+ p.load_from_data(force_background_css.printf(selector, color));
+ widget.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ } catch (GLib.Error err) {
+ // handle err
+ }
+ }
+
+ public static void force_base_background(Gtk.Widget widget, string selector = "*") {
+ force_background(widget, "@theme_base_color", selector);
+ }
}
} \ No newline at end of file