diff options
Diffstat (limited to 'js/setTheme.js')
-rw-r--r-- | js/setTheme.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/js/setTheme.js b/js/setTheme.js index 31cf807..b90f629 100644 --- a/js/setTheme.js +++ b/js/setTheme.js @@ -3,21 +3,27 @@ function setTheme(theme) { var root = document.querySelector(":root"); var rootstyle = getComputedStyle(root); const black = rootstyle.getPropertyValue("--black"); + const darkgrey = rootstyle.getPropertyValue("--darkgrey"); + const lightgrey = rootstyle.getPropertyValue("--lightgrey"); const white = rootstyle.getPropertyValue("--white"); - var bgcol; - var fgcol; + var backgroundColour0; + var backgroundColour1; + var foregroundColour; if (theme === "dark") { - bgcol = black; - fgcol = white; + backgroundColour0 = black; + backgroundColour1 = darkgrey; + foregroundColour = white; } else if (theme === "light") { - bgcol = white; - fgcol = black; + backgroundColour0 = lightgrey; + backgroundColour1 = white; + foregroundColour = black; } else { setTheme("dark"); return; } - root.style.setProperty("--backgroundColour",bgcol); - root.style.setProperty("--foregroundColour",fgcol); + root.style.setProperty("--backgroundColour0",backgroundColour0); + root.style.setProperty("--backgroundColour1",backgroundColour1); + root.style.setProperty("--foregroundColour",foregroundColour); } |