-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
34 lines (29 loc) · 1009 Bytes
/
index.html
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
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Tauri + Yew App</title>
<script>
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", function (e) {
console.log(e)
const colorScheme = e.matches ? "dark" : "light";
console.log(colorScheme);
if (colorScheme === "dark") {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
});
</script>
<link data-trunk rel="css" href="assets/styles.css" />
<link data-trunk rel="copy-dir" href="public" />
</head>
</html>