better naming

This commit is contained in:
Bruno Windels 2020-06-23 17:52:54 +02:00
parent de5d4222ad
commit 86597aabca

View File

@ -39,7 +39,7 @@ export function enumerateThemes() {
function setCustomThemeVars(customTheme) {
const {style} = document.body;
function setCSSVariable(name, hexColor, doPct = true) {
function setCSSColorVariable(name, hexColor, doPct = true) {
style.setProperty(`--${name}`, hexColor);
if (doPct) {
// uses #rrggbbaa to define the color with alpha values at 0%, 15% and 50%
@ -53,10 +53,10 @@ function setCustomThemeVars(customTheme) {
for (const [name, value] of Object.entries(customTheme.colors)) {
if (Array.isArray(value)) {
for (let i = 0; i < value.length; i += 1) {
setCSSVariable(`${name}_${i}`, value[i], false);
setCSSColorVariable(`${name}_${i}`, value[i], false);
}
} else {
setCSSVariable(name, value);
setCSSColorVariable(name, value);
}
}
}