17 lines
447 B
JavaScript
17 lines
447 B
JavaScript
|
// @ts-check
|
||
|
|
||
|
////////////////////////////////////////
|
||
|
|
||
|
let existingTheme = localStorage.getItem("theme");
|
||
|
|
||
|
////////////////////////////////////////
|
||
|
|
||
|
if (!existingTheme) {
|
||
|
localStorage.setItem("theme", "light");
|
||
|
existingTheme = "light";
|
||
|
} else if (existingTheme?.match(/dark/)) {
|
||
|
document.documentElement.className = "dark";
|
||
|
} else if (existingTheme?.match(/light/)) {
|
||
|
document.documentElement.className = "light";
|
||
|
}
|