From e4cdbe6a9107943f5ee7fede16f64f8201056221 Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Thu, 16 Jan 2025 11:14:44 +0100 Subject: [PATCH] fix: prevent FOUC for theme (#1110) Closes #1109 --- packages/site-kit/src/lib/components/ThemeToggle.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/site-kit/src/lib/components/ThemeToggle.svelte b/packages/site-kit/src/lib/components/ThemeToggle.svelte index 8135b48ca..83189f29e 100644 --- a/packages/site-kit/src/lib/components/ThemeToggle.svelte +++ b/packages/site-kit/src/lib/components/ThemeToggle.svelte @@ -17,7 +17,7 @@ const theme = localStorage.getItem('sv:theme'); document.documentElement.classList.add( - theme === 'system' + !theme || theme === 'system' ? window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'