[gnome-characters] characterList: Read canvas colors from CSS



commit 3f670d9965b5c16386fcfb83786196df0e8872ef
Author: Daiki Ueno <dueno src gnome org>
Date:   Thu Feb 12 15:25:54 2015 +0900

    characterList: Read canvas colors from CSS

 data/application.css |    1 +
 src/characterList.js |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/data/application.css b/data/application.css
index 7a29980..5f4fb3c 100644
--- a/data/application.css
+++ b/data/application.css
@@ -26,6 +26,7 @@
 }
 
 .character-list {
+    color: rgb(0, 0, 0);
     background-color: rgb(255, 255, 255);
 }
 
diff --git a/src/characterList.js b/src/characterList.js
index 616acd6..9a623ca 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -202,10 +202,13 @@ const CharacterListWidget = new Lang.Class({
 
     vfunc_draw: function(cr) {
         // Clear the canvas.
-        // FIXME: Pick the background color from CSS.
-        cr.setSourceRGBA(1, 1, 1, 1);
+        let context = this.get_style_context();
+        let fg = context.get_color(Gtk.StateFlags.NORMAL);
+        let bg = context.get_background_color(Gtk.StateFlags.NORMAL);
+
+        cr.setSourceRGBA(bg.red, bg.green, bg.blue, bg.alpha);
         cr.paint();
-        cr.setSourceRGBA(0, 0, 0, 1);
+        cr.setSourceRGBA(fg.red, fg.green, fg.blue, fg.alpha);
 
         // Use device coordinates directly, since PangoCairo doesn't
         // work well with scaled matrix:


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