[refactor] improve theme color

This commit is contained in:
zombieFox 2020-01-05 20:58:31 -07:00
parent 68b12669b9
commit dede8e43b3

View File

@ -1041,7 +1041,6 @@ var theme = (function() {
render.color = { render.color = {
shade: function() { shade: function() {
var shadeSteps = 10; var shadeSteps = 10;
var saturationShift = 0;
var lightShift = 4; var lightShift = 4;
var html = helper.e("html"); var html = helper.e("html");
var hsl = helper.convertColor.rgb.hsl(state.get.current().theme.color.rgb); var hsl = helper.convertColor.rgb.hsl(state.get.current().theme.color.rgb);
@ -1057,15 +1056,13 @@ var theme = (function() {
}; };
if (index < 10) { if (index < 10) {
index = "0" + index; index = "0" + index;
} else {
index = index;
}; };
html.style.setProperty(name + index, rgb.r + ", " + rgb.g + ", " + rgb.b); html.style.setProperty(name + index, rgb.r + ", " + rgb.g + ", " + rgb.b);
}; };
for (var i = 1; i <= shadeSteps; i++) { for (var i = 1; i <= shadeSteps; i++) {
var rgb = helper.convertColor.hsl.rgb({ var rgb = helper.convertColor.hsl.rgb({
h: hsl.h, h: hsl.h,
s: hsl.s - (saturationShift * i), s: hsl.s,
l: hsl.l - (lightShift * i) l: hsl.l - (lightShift * i)
}); });
renderShade("--theme-shade-neg-", i, rgb); renderShade("--theme-shade-neg-", i, rgb);
@ -1073,7 +1070,7 @@ var theme = (function() {
for (var i = 1; i <= shadeSteps; i++) { for (var i = 1; i <= shadeSteps; i++) {
var rgb = helper.convertColor.hsl.rgb({ var rgb = helper.convertColor.hsl.rgb({
h: hsl.h, h: hsl.h,
s: hsl.s + (saturationShift * i), s: hsl.s,
l: hsl.l + (lightShift * i) l: hsl.l + (lightShift * i)
}); });
renderShade("--theme-shade-pos-", i, rgb); renderShade("--theme-shade-pos-", i, rgb);