[Theme] light/dark persistance
This commit is contained in:
@@ -15,6 +15,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
/* Functions */
|
||||
|
||||
const changeToDarkTheme = () => {
|
||||
window.localStorage.setItem("theme", "dark");
|
||||
document.documentElement.classList.add("dark");
|
||||
themeBtn?.setAttribute("title", "turn the light on");
|
||||
Array.from(imgs).forEach((img) => {
|
||||
@@ -23,6 +24,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
|
||||
const changeToLightTheme = () => {
|
||||
window.localStorage.setItem("theme", "light");
|
||||
document.documentElement.classList.remove("dark");
|
||||
themeBtn?.setAttribute("title", "turn the light off");
|
||||
Array.from(imgs).forEach((img) => {
|
||||
|
||||
Reference in New Issue
Block a user