-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
44 lines (44 loc) · 1.2 KB
/
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
35
36
37
38
39
40
41
42
43
44
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script>
function setTheme() {
let e = 'color-mode',
t = document.documentElement,
a = localStorage.getItem(e)
function h() {
return window.matchMedia
? window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: window.matchMedia('(prefers-color-scheme: light)').matches
? 'light'
: void 0
: void 0
}
if (!a) {
t.dataset.theme = h() || 'light'
return
}
switch ((a = JSON.parse(a))) {
case 'dark':
t.dataset.theme = 'dark'
break
case 'light':
t.dataset.theme = 'light'
break
case 'system':
t.dataset.theme = h() || 'light'
}
}
setTheme()
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>