-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
54 lines (50 loc) · 1.23 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
45
46
47
48
49
50
51
52
53
54
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<link
rel="icon"
type="image/svg+xml"
href="/favicon.svg"
/>
<link
href="https://cdn.jsdelivr.net/gh/sun-typeface/SUIT/fonts/variable/woff2/SUIT-Variable.css"
rel="stylesheet"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<meta
name="color-scheme"
content="light dark"
/>
<script>
const mql = window.matchMedia('(prefers-color-scheme: dark)');
const handleTheme = (e) => {
try {
const currentTheme = JSON.parse(
localStorage.getItem('BREWERS_THEME') ?? '""'
);
if (currentTheme !== '') {
document.documentElement.className = currentTheme;
} else {
document.documentElement.className = e.matches ? 'dark' : 'light';
}
} catch (e) {
console.error(e, 'ThemeInit');
}
};
handleTheme(mql);
mql.addEventListener('change', handleTheme);
</script>
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script
type="module"
src="/src/main.tsx"
></script>
</body>
</html>