cxgraph/cxgraph-web/static/themes.js

22 lines
548 B
JavaScript
Raw Permalink Normal View History

2024-09-17 21:45:56 +00:00
function themeChange() {
if (checkbox_theme.checked) {
body.classList.remove("theme_light");
body.classList.add("theme_dark");
} else {
body.classList.remove("theme_dark");
body.classList.add("theme_light");
}
localStorage.setItem("theme", checkbox_theme.checked ? "dark" : "light");
}
checkbox_theme.addEventListener("change", themeChange);
if (localStorage.getItem("theme") !== null) {
if (localStorage.getItem("theme") == "light") {
checkbox_theme.checked = false;
} else {
checkbox_theme.checked = true;
}
}
themeChange();