diff --git a/src/lib/components/chat/Settings/General.svelte b/src/lib/components/chat/Settings/General.svelte index 51252cf65..76db8819e 100644 --- a/src/lib/components/chat/Settings/General.svelte +++ b/src/lib/components/chat/Settings/General.svelte @@ -141,12 +141,10 @@ } } - console.log(_theme); - }; + if (typeof window !== 'undefined' && window.applyTheme) { + window.applyTheme(); + } - const themeChangeHandler = (_theme: string) => { - theme.set(_theme); - localStorage.setItem('theme', _theme); if (_theme.includes('oled')) { document.documentElement.style.setProperty('--color-gray-800', '#101010'); document.documentElement.style.setProperty('--color-gray-850', '#050505'); @@ -154,6 +152,13 @@ document.documentElement.style.setProperty('--color-gray-950', '#000000'); document.documentElement.classList.add('dark'); } + + console.log(_theme); + }; + + const themeChangeHandler = (_theme: string) => { + theme.set(_theme); + localStorage.setItem('theme', _theme); applyTheme(_theme); }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 243130930..d6383caa5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -396,6 +396,10 @@ }; onMount(async () => { + if (typeof window !== 'undefined' && window.applyTheme) { + window.applyTheme(); + } + if (window?.electronAPI) { const info = await window.electronAPI.send({ type: 'app:info'