[gnome-klotski/arnaudb/wip/gtk4: 9/13] Fix color init.



commit 7cd836b3ab1af1318f5b9324385b87b074be32ee
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Mar 6 01:15:49 2020 +0100

    Fix color init.

 src/puzzle-view.vala | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/puzzle-view.vala b/src/puzzle-view.vala
index d3e87c6..fc47b94 100644
--- a/src/puzzle-view.vala
+++ b/src/puzzle-view.vala
@@ -143,8 +143,10 @@ private class PuzzleView : Gtk.DrawingArea
 
         style_context.save ();
         style_context.set_state (Gtk.StateFlags.NORMAL);
-        Gdk.RGBA fg = style_context.get_color (Gtk.StateFlags.NORMAL);
-        Gdk.RGBA bg = style_context.get_background_color (Gtk.StateFlags.NORMAL);
+        Gdk.RGBA fg = style_context.get_color ();
+        Gdk.RGBA bg;
+        if (!style_context.lookup_color ("theme_bg_color", out bg))
+            bg = { /* 246 */ 0.9647f, /* 245 */ 0.9608f, /* 244 */ 0.9569f, 1.0f }; // #f6f5f4 is 
Adwaita-light bg_color
         style_context.restore ();
 
         Gdk.cairo_set_source_rgba (cr, bg);
@@ -188,7 +190,9 @@ private class PuzzleView : Gtk.DrawingArea
 
         style_context.save ();
         style_context.set_state (Gtk.StateFlags.NORMAL);
-        Gdk.RGBA bg = style_context.get_background_color (Gtk.StateFlags.NORMAL);
+        Gdk.RGBA bg;
+        if (!style_context.lookup_color ("theme_bg_color", out bg))
+            bg = { /* 246 */ 0.9647f, /* 245 */ 0.9608f, /* 244 */ 0.9569f, 1.0f }; // #f6f5f4 is 
Adwaita-light bg_color
         style_context.restore ();
 
         Gdk.cairo_rectangle (cr, rect);


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