Commit
•
3e3029f
1
Parent(s):
17a481a
🩹 No flicker for dark theme (#111)
Browse files- src/app.html +8 -8
src/app.html
CHANGED
@@ -5,17 +5,17 @@
|
|
5 |
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
7 |
<title>HuggingChat</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
%sveltekit.head%
|
9 |
</head>
|
10 |
<body data-sveltekit-preload-data="hover" class="dark:bg-gray-900 h-full">
|
11 |
<div class="contents h-full">%sveltekit.body%</div>
|
12 |
</body>
|
13 |
-
<script>
|
14 |
-
if (
|
15 |
-
localStorage.theme === "dark" ||
|
16 |
-
(!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
|
17 |
-
) {
|
18 |
-
document.documentElement.classList.add("dark");
|
19 |
-
}
|
20 |
-
</script>
|
21 |
</html>
|
|
|
5 |
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
7 |
<title>HuggingChat</title>
|
8 |
+
<script>
|
9 |
+
if (
|
10 |
+
localStorage.theme === "dark" ||
|
11 |
+
(!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
|
12 |
+
) {
|
13 |
+
document.documentElement.classList.add("dark");
|
14 |
+
}
|
15 |
+
</script>
|
16 |
%sveltekit.head%
|
17 |
</head>
|
18 |
<body data-sveltekit-preload-data="hover" class="dark:bg-gray-900 h-full">
|
19 |
<div class="contents h-full">%sveltekit.body%</div>
|
20 |
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</html>
|