From 6a92652ca1fa6dd203c326d6dc2ca5c3080a0921 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 1 Jan 2024 19:36:09 -0800 Subject: [PATCH] fix: custom theme light/dark support --- src/app.html | 5 +++-- src/lib/components/chat/SettingsModal.svelte | 18 +++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/app.html b/src/app.html index c2268851..642a570e 100644 --- a/src/app.html +++ b/src/app.html @@ -15,8 +15,9 @@ } else if (localStorage.theme === 'dark') { document.documentElement.classList.add('dark'); } else { - document.documentElement.classList.add('dark'); - document.documentElement.classList.add(localStorage.theme); + localStorage.theme.split(' ').forEach((e) => { + document.documentElement.classList.add(e); + }); } diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 963e616f..a220bd4e 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -34,7 +34,7 @@ // General let API_BASE_URL = OLLAMA_API_BASE_URL; - let themes = ['dark', 'light', 'rose-pine', 'rose-pine-dawn']; + let themes = ['dark', 'light', 'rose-pine dark', 'rose-pine-dawn light']; let theme = 'dark'; let notificationEnabled = false; let system = ''; @@ -994,22 +994,22 @@ themes .filter((e) => e !== theme) .forEach((e) => { - document.documentElement.classList.remove(e); + e.split(' ').forEach((e) => { + document.documentElement.classList.remove(e); + }); }); - document.documentElement.classList.add(theme); - - if (!['light', 'dark'].includes(theme)) { - document.documentElement.classList.add('dark'); - } + theme.split(' ').forEach((e) => { + document.documentElement.classList.add(e); + }); console.log(theme); }} > - - + +