-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (56 loc) · 1.67 KB
/
index.html
File metadata and controls
62 lines (56 loc) · 1.67 KB
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
55
56
57
58
59
60
61
62
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/app-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
html,
body,
#root {
min-height: 100%;
margin: 0;
}
html,
body,
#root {
background: #f5f7fb;
}
html.dark,
html.dark body,
html.dark #root {
background: #171b25;
}
</style>
<script>
(() => {
const storageKey = "tiy-agent-theme";
const darkBackground = "#171b25";
const lightBackground = "#f5f7fb";
let storedValue = "system";
try {
const candidate = window.localStorage.getItem(storageKey);
if (candidate === "light" || candidate === "dark" || candidate === "system") {
storedValue = candidate;
}
} catch {
storedValue = "system";
}
const prefersDark =
typeof window.matchMedia === "function" &&
window.matchMedia("(prefers-color-scheme: dark)").matches;
const resolvedTheme = storedValue === "system" ? (prefersDark ? "dark" : "light") : storedValue;
const root = document.documentElement;
root.classList.toggle("dark", resolvedTheme === "dark");
root.dataset.theme = resolvedTheme;
root.style.colorScheme = resolvedTheme;
root.style.backgroundColor = resolvedTheme === "dark" ? darkBackground : lightBackground;
})();
</script>
<title>TiyCode</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>