From a2bf00c17b3ef54728db434d90da1e8ff42696be Mon Sep 17 00:00:00 2001 From: Craig Howell Date: Wed, 5 Oct 2022 22:07:23 -0400 Subject: [PATCH] fix(+layout): added browser check for darkMode --- src/routes/+layout.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index dec00ccc..a2f7e6e9 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import { page } from '$app/stores'; import { Button, Drawer, Swap, Icon, Layout, Menu, Portal, Row, Toggle } from '../lib'; + import { browser } from '$app/environment'; const sidebarItems = [ { @@ -172,10 +173,10 @@ openMenu = false; } - $: if (darkTheme) { + $: if (browser && darkTheme) { const htmlElement = document.documentElement; htmlElement.classList.add('dark'); - } else { + } else if (browser) { const htmlElement = document.documentElement; htmlElement.classList.remove('dark'); }