From cadbd32d8c875d1b15f0c52b592e85ab1d62a487 Mon Sep 17 00:00:00 2001 From: Eamonn de Leastar Date: Fri, 6 Dec 2024 07:17:07 +0000 Subject: [PATCH] one off force theme --- .../ui/navigators/titles/CourseTitle.svelte | 1 - src/lib/ui/themes/theme-controller.svelte.ts | 18 ++++++++++++------ src/routes/+layout.svelte | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/ui/navigators/titles/CourseTitle.svelte b/src/lib/ui/navigators/titles/CourseTitle.svelte index 7f0931e3..ed9bce0b 100644 --- a/src/lib/ui/navigators/titles/CourseTitle.svelte +++ b/src/lib/ui/navigators/titles/CourseTitle.svelte @@ -1,7 +1,6 @@ {#if currentLo?.value} diff --git a/src/lib/ui/themes/theme-controller.svelte.ts b/src/lib/ui/themes/theme-controller.svelte.ts index 981a6a44..59594a19 100644 --- a/src/lib/ui/themes/theme-controller.svelte.ts +++ b/src/lib/ui/themes/theme-controller.svelte.ts @@ -18,14 +18,20 @@ export const themeService = { isSnowing: false, - initDisplay(): void { - if (localStorage.modeCurrent) { - lightMode.value = localStorage.modeCurrent; + initDisplay(forceTheme?: string, forceMode?: string): void { + if (forceTheme && forceMode && !localStorage.forceTheme) { + this.setDisplayMode(forceMode); + this.setTheme(forceTheme); + localStorage.forceTheme = true; } else { - lightMode.value = "light"; + if (localStorage.modeCurrent) { + lightMode.value = localStorage.modeCurrent; + } else { + lightMode.value = "light"; + } + this.setDisplayMode(localStorage.modeCurrent); + this.setTheme(localStorage.theme); } - this.setDisplayMode(localStorage.modeCurrent); - this.setTheme(localStorage.theme); }, setDisplayMode(mode: string): void { diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index bc99eb87..9d42a42f 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -18,7 +18,7 @@ onMount(async () => { if (browser) { - themeService.initDisplay(); + themeService.initDisplay("festive", "dark"); } });