-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (48 loc) · 1.87 KB
/
index.html
File metadata and controls
48 lines (48 loc) · 1.87 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
<!doctype html>
<html lang="en" class="dark" data-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lightcode</title>
<script>
// Pre-paint theme bootstrap: apply the saved appearance + background before
// the first frame so the initial paint matches the active theme instead of
// flashing the hardcoded base palette. The renderer re-applies the full
// token set on mount (see renderer/theme/applyAppTheme.ts).
(function () {
try {
var root = document.documentElement;
var boot = JSON.parse(localStorage.getItem("lightcode-boot") || "null");
var appearance =
boot && (boot.appearance === "light" || boot.appearance === "dark")
? boot.appearance
: null;
if (!appearance) {
var settings = JSON.parse(localStorage.getItem("lightcode-shared-settings") || "null");
var mode = settings && settings.themeMode;
var prefersDark =
!window.matchMedia || window.matchMedia("(prefers-color-scheme: dark)").matches;
appearance =
mode === "light"
? "light"
: mode === "dark"
? "dark"
: prefersDark
? "dark"
: "light";
}
root.classList.remove("light", "dark");
root.classList.add(appearance);
root.dataset.theme = appearance;
if (boot && boot.bg) root.style.backgroundColor = boot.bg;
} catch (e) {
// Ignore; the renderer applies real settings shortly after mount.
}
})();
</script>
</head>
<body class="bg-background text-foreground">
<div id="root"></div>
<script type="module" src="/src/renderer/main.tsx"></script>
</body>
</html>