[gnome-documents/wip/epub-colors] epub: Setting the view background color in night mode



commit 61cafad034b4c8a97dae292a7a33cc95dd3a3b14
Author: Daniel Garcia Moreno <danigm wadobo com>
Date:   Fri Jul 1 18:13:03 2016 +0200

    epub: Setting the view background color in night mode

 src/epubview.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/epubview.js b/src/epubview.js
index 6e93465..f6453a5 100644
--- a/src/epubview.js
+++ b/src/epubview.js
@@ -22,7 +22,7 @@
 const GdPrivate = imports.gi.GdPrivate;
 const Gepub = imports.gi.Gepub;
 const Gio = imports.gi.Gio;
-const Gtk = imports.gi.Gtk;
+const Gdk = imports.gi.Gdk;
 const WebKit2 = imports.gi.WebKit2;
 
 const _ = imports.gettext.gettext;
@@ -114,12 +114,18 @@ const EPUBView = new Lang.Class({
 
     _setInvertedColors: function(invert) {
         let script;
+        let bgcolor;
+
         if (invert) {
             script = "document.querySelector('body').style.backgroundColor = 'black';";
             script += "document.querySelector('body').style.color = 'white';";
+            bgcolor = new Gdk.RGBA({red: 0, green: 0, blue: 0, alpha: 1});
+            this.view.set_background_color(bgcolor);
         } else {
             script = "document.querySelector('body').style.backgroundColor = '';";
             script += "document.querySelector('body').style.color = '';";
+            bgcolor = new Gdk.RGBA({red: 255, green: 255, blue: 255, alpha: 1});
+            this.view.set_background_color(bgcolor);
         }
         this.view.run_javascript(script, null, null);
     },


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