diff options
Diffstat (limited to 'static/common.js')
| -rw-r--r-- | static/common.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/static/common.js b/static/common.js index e3566b1..a7dc3a5 100644 --- a/static/common.js +++ b/static/common.js @@ -1,7 +1,10 @@ -var isLightMode = false; +function setMode() { + if (localStorage.getItem("theme") == "light") + setLightMode(); +} function ToggleMode() { - if (isLightMode) + if (localStorage.getItem("theme") == "light") setDarkMode(); else setLightMode(); @@ -9,14 +12,14 @@ function ToggleMode() { function setLightMode() { swapClasses("dark", "light"); - isLightMode = true; + localStorage.setItem("theme", "light"); document.getElementById("toggleIcon").src = "static/toggle.svg" document.getElementById("homeIcon").src = "static/home_dark.svg" } function setDarkMode() { swapClasses("light", "dark"); - isLightMode = false; + localStorage.setItem("theme", "dark"); document.getElementById("toggleIcon").src = "static/toggle_dark.svg" document.getElementById("homeIcon").src = "static/home.svg" } |
