From 56a70f5530bf969222f87cdd8c8cfec7af661efe Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Wed, 15 Nov 2017 10:40:07 +0000 Subject: [PATCH] Add tinting for lowlights. --- src/Tinter.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Tinter.js b/src/Tinter.js index f2a02b6e6d..cbecccf9ab 100644 --- a/src/Tinter.js +++ b/src/Tinter.js @@ -72,6 +72,7 @@ class Tinter { "#EAF5F0", // Vector Light Green "#D3EFE1", // roomsublist-label-bg-color (20% Green overlaid on Light Green) "#FFFFFF", // white highlights of the SVGs (for switching to dark theme) + "#000000", // black lowlights of the SVGs (for switching to dark theme) ]; // track the replacement colours actually being used @@ -81,6 +82,7 @@ class Tinter { this.keyHex[1], this.keyHex[2], this.keyHex[3], + this.keyHex[4], ]; // track the most current tint request inputs (which may differ from the @@ -90,6 +92,7 @@ class Tinter { undefined, undefined, undefined, + undefined, ]; this.cssFixups = [ @@ -223,7 +226,23 @@ class Tinter { }); } - setTheme(theme) { + tintSvgBlack(blackColor) { + this.currentTint[4] = blackColor; + + if (!blackColor) { + blackColor = this.colors[4]; + } + if (this.colors[4] === blackColor) { + return; + } + this.colors[4] = blackColor; + this.tintables.forEach(function(tintable) { + tintable(); + }); + } + + + setTheme(theme) { this.theme = theme; // update keyRgb from the current theme CSS itself, if it defines it @@ -252,8 +271,10 @@ class Tinter { // abuse the tinter to change all the SVG's #fff to #2d2d2d // XXX: obviously this shouldn't be hardcoded here. this.tintSvgWhite('#2d2d2d'); + this.tintSvgBlack('#dddddd'); } else { this.tintSvgWhite('#ffffff'); + this.tintSvgBlack('#000000'); } }