[Theme] light/dark persistance

This commit is contained in:
2026-08-09 04:43:46 +02:00
parent b4a968d991
commit db0169f34b
+2
View File
@@ -15,6 +15,7 @@ window.addEventListener("DOMContentLoaded", () => {
/* Functions */ /* Functions */
const changeToDarkTheme = () => { const changeToDarkTheme = () => {
window.localStorage.setItem("theme", "dark");
document.documentElement.classList.add("dark"); document.documentElement.classList.add("dark");
themeBtn?.setAttribute("title", "turn the light on"); themeBtn?.setAttribute("title", "turn the light on");
Array.from(imgs).forEach((img) => { Array.from(imgs).forEach((img) => {
@@ -23,6 +24,7 @@ window.addEventListener("DOMContentLoaded", () => {
} }
const changeToLightTheme = () => { const changeToLightTheme = () => {
window.localStorage.setItem("theme", "light");
document.documentElement.classList.remove("dark"); document.documentElement.classList.remove("dark");
themeBtn?.setAttribute("title", "turn the light off"); themeBtn?.setAttribute("title", "turn the light off");
Array.from(imgs).forEach((img) => { Array.from(imgs).forEach((img) => {