diff options
author | Adam Stück <adam@adast.xyz> | 2023-03-04 19:16:42 +0100 |
---|---|---|
committer | Adam Stück <adam@adast.xyz> | 2023-03-04 19:16:42 +0100 |
commit | ab41be00ede879e57608d05044d268098fb820a3 (patch) | |
tree | 54705b0065c11b8d95b4d9ceb80f5a29bbd48710 /src/scripts | |
parent | 80f69003909e1f4362cd1bd4289668fd60d65820 (diff) |
Website redesign
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/darktheme.js | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/scripts/darktheme.js b/src/scripts/darktheme.js deleted file mode 100644 index a3f0333..0000000 --- a/src/scripts/darktheme.js +++ /dev/null @@ -1,27 +0,0 @@ -const themeButton = document.getElementById('darkmodetoggle'); -const theme = localStorage.getItem("theme"); -var isDark = false; - -if (theme) { - setTheme(theme === "dark"); -} else if (window.matchMedia - && window.matchMedia("(prefers-color-scheme: dark)").matches) { - setTheme(true); -} - -function setTheme(dark) { - if (dark) { - document.documentElement.classList.add("dark-mode"); - // themeButton.className = "fa fa-sun-o"; - localStorage.setItem("theme", "dark"); - } else { - document.documentElement.classList.remove("dark-mode"); - // themeButton.className = "fa fa-moon-o"; - localStorage.setItem("theme", "light"); - } - isDark = dark; -} - -function switchTheme() { - setTheme(!isDark); -} |