[refactor] switch to rounding theme colours

This commit is contained in:
zombieFox 2020-01-21 20:45:24 +00:00
parent b734855510
commit db0e51505b
5 changed files with 16 additions and 16 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "4.29.0", "version": "4.31.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "4.29.0", "version": "4.31.0",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -139,9 +139,9 @@ var theme = (function() {
object: state.get.current(), object: state.get.current(),
path: "theme.accent.rgb", path: "theme.accent.rgb",
newValue: { newValue: {
r: parseInt(rgb.r, 10), r: Math.round(rgb.r),
g: parseInt(rgb.g, 10), g: Math.round(rgb.g),
b: parseInt(rgb.b, 10) b: Math.round(rgb.b)
} }
}); });
}; };
@ -155,9 +155,9 @@ var theme = (function() {
object: state.get.current(), object: state.get.current(),
path: "theme.color.hsl", path: "theme.color.hsl",
newValue: { newValue: {
h: parseInt(hsl.h, 10), h: Math.round(hsl.h),
s: parseInt(hsl.s, 10), s: Math.round(hsl.s),
l: parseInt(hsl.l, 10) l: Math.round(hsl.l)
} }
}); });
}, },
@ -167,9 +167,9 @@ var theme = (function() {
object: state.get.current(), object: state.get.current(),
path: "theme.color.rgb", path: "theme.color.rgb",
newValue: { newValue: {
r: parseInt(rgb.r, 10), r: Math.round(rgb.r),
g: parseInt(rgb.g, 10), g: Math.round(rgb.g),
b: parseInt(rgb.b, 10) b: Math.round(rgb.b)
} }
}); });
} }
@ -1381,7 +1381,7 @@ var theme = (function() {
} else if (rgb[key] > 255) { } else if (rgb[key] > 255) {
rgb[key] = 255; rgb[key] = 255;
}; };
rgb[key] = parseInt(rgb[key], 10); rgb[key] = Math.round(rgb[key]);
}; };
if (index < 10) { if (index < 10) {
index = "0" + index; index = "0" + index;
@ -1550,7 +1550,7 @@ var theme = (function() {
} else if (rgb[colorKey] > 255) { } else if (rgb[colorKey] > 255) {
rgb[colorKey] = 255; rgb[colorKey] = 255;
}; };
rgb[colorKey] = parseInt(rgb[colorKey], 10); rgb[colorKey] = Math.round(rgb[colorKey]);
}; };
var themePresetBackground = helper.node("span|class:theme-preset-background-0" + i); var themePresetBackground = helper.node("span|class:theme-preset-background-0" + i);
themePresetBackground.style.setProperty("background-color", "rgb(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ")"); themePresetBackground.style.setProperty("background-color", "rgb(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ")");
@ -1633,7 +1633,7 @@ var theme = (function() {
} else if (rgb[colorKey] > 255) { } else if (rgb[colorKey] > 255) {
rgb[colorKey] = 255; rgb[colorKey] = 255;
}; };
rgb[colorKey] = parseInt(rgb[colorKey], 10); rgb[colorKey] = Math.round(rgb[colorKey]);
}; };
var themeCustomBackground = helper.node("span|class:theme-custom-background-0" + i); var themeCustomBackground = helper.node("span|class:theme-custom-background-0" + i);
themeCustomBackground.style.setProperty("background-color", "rgb(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ")"); themeCustomBackground.style.setProperty("background-color", "rgb(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ")");

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "4.29.0"; var current = "4.31.0";
var name = "Naughty Goose"; var name = "Naughty Goose";

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_name": "nightTab", "short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "4.29.0", "version": "4.31.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"