We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22cc475 commit c808ebfCopy full SHA for c808ebf
sites/svelte.dev/src/app.html
@@ -30,6 +30,16 @@
30
%sveltekit.head%
31
</head>
32
<body data-sveltekit-preload-code="hover">
33
+ <script>
34
+ const themeValue = JSON.parse(localStorage.getItem('svelte:theme'))?.current;
35
+ const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
36
+ ? 'dark'
37
+ : 'light';
38
+
39
+ document.body.classList.remove('light', 'dark');
40
+ document.body.classList.add(themeValue ?? systemPreferredTheme);
41
+ </script>
42
43
<div style="height: 100%">%sveltekit.body%</div>
44
</body>
45
</html>
0 commit comments