-19
src/ffi.mjs
-19
src/ffi.mjs
···
1
-
export function get_route() {
2
-
return window.location.pathname
3
-
}
4
-
5
-
export function init_theme() {
6
-
if (window.matchMedia('(prefers-color-scheme:dark)').matches) {
7
-
document.documentElement.classList.add("dark")
8
-
} else {
9
-
document.documentElement.classList.remove("dark")
10
-
}
11
-
}
12
-
13
-
export function is_dark_mode() {
14
-
return document.documentElement.classList.contains("dark")
15
-
}
16
-
17
-
export function switch_theme() {
18
-
document.documentElement.classList.toggle("dark")
19
-
}