fix: Flash of inAccurate coloR Theme (FART)

pull/8788/head
Puru Vijay 1 year ago
parent 22cc4756e0
commit c808ebf2c4

@ -30,6 +30,16 @@
%sveltekit.head%
</head>
<body data-sveltekit-preload-code="hover">
<script>
const themeValue = JSON.parse(localStorage.getItem('svelte:theme'))?.current;
const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light';
document.body.classList.remove('light', 'dark');
document.body.classList.add(themeValue ?? systemPreferredTheme);
</script>
<div style="height: 100%">%sveltekit.body%</div>
</body>
</html>

Loading…
Cancel
Save