let the tinter handle 'white' highlights of SVGs too

pull/21833/head
Matthew Hodgson 2017-01-17 19:13:04 +00:00
parent a18d94099e
commit c2cdb626bd
1 changed files with 10 additions and 3 deletions

View File

@ -42,6 +42,7 @@ var keyHex = [
"#76CFA6", // Vector Green "#76CFA6", // Vector Green
"#EAF5F0", // Vector Light Green "#EAF5F0", // Vector Light Green
"#D3EFE1", // BottomLeftMenu overlay (20% Vector Green overlaid on Vector Light Green) "#D3EFE1", // BottomLeftMenu overlay (20% Vector Green overlaid on Vector Light Green)
"#FFFFFF", // white highlights of the SVGs (for switching to dark theme)
]; ];
// cache of our replacement colours // cache of our replacement colours
@ -50,6 +51,7 @@ var colors = [
keyHex[0], keyHex[0],
keyHex[1], keyHex[1],
keyHex[2], keyHex[2],
keyHex[3],
]; ];
var cssFixups = [ var cssFixups = [
@ -172,7 +174,7 @@ module.exports = {
tintables.push(tintable); tintables.push(tintable);
}, },
tint: function(primaryColor, secondaryColor, tertiaryColor) { tint: function(primaryColor, secondaryColor, tertiaryColor, whiteColor) {
if (!cached) { if (!cached) {
calcCssFixups(); calcCssFixups();
@ -203,14 +205,19 @@ module.exports = {
tertiaryColor = rgbToHex(rgb1); tertiaryColor = rgbToHex(rgb1);
} }
if (!whiteColor) {
whiteColor = colors[3];
}
if (colors[0] === primaryColor && if (colors[0] === primaryColor &&
colors[1] === secondaryColor && colors[1] === secondaryColor &&
colors[2] === tertiaryColor) colors[2] === tertiaryColor &&
colors[3] === whiteColor)
{ {
return; return;
} }
colors = [primaryColor, secondaryColor, tertiaryColor]; colors = [primaryColor, secondaryColor, tertiaryColor, whiteColor];
if (DEBUG) console.log("Tinter.tint"); if (DEBUG) console.log("Tinter.tint");