Core

/client/src/mode.ts (611 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {els} from "./dom";

const l = "mode-light";
const d = "mode-dark";

export function modeInit() {
for (const el of els<HTMLInputElement>(".mode-input")) {
el.onclick = () => {
switch (el.value) {
case "":
document.body.classList.remove(l);
document.body.classList.remove(d);
break;
case "light":
document.body.classList.add(l);
document.body.classList.remove(d);
break;
case "dark":
document.body.classList.remove(l);
document.body.classList.add(d);
break;
}
};
}
}