From 69edba003621a9ba450ba35c26c9b5e5622cf24d Mon Sep 17 00:00:00 2001 From: Jeroen Nijhuis Date: Sun, 21 Apr 2024 13:35:46 +0200 Subject: [PATCH] fix: correctly load color scheme from settings on launch --- src/App.vue | 29 +++++++++++++++------------- src/providers/ColorSchemeProvider.ts | 15 ++++++++++++++ 2 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 src/providers/ColorSchemeProvider.ts diff --git a/src/App.vue b/src/App.vue index 62780d6..c597408 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,6 +5,7 @@ import RouterViewport from "@/components/RouterViewport.vue"; import Toaster from "@/components/ui/toast/Toaster.vue"; import CommandPalette from "./components/CommandPalette.vue"; import SettingsContextProvider from "./providers/SettingsContextProvider"; +import ColorSchemeProvider from "./providers/ColorSchemeProvider"; import KubeContextProvider from "./providers/KubeContextProvider"; import CommandPaletteProvider from "./providers/CommandPaletteProvider"; import TabProvider from "./providers/TabProvider"; @@ -18,19 +19,21 @@ import DialogHandler from "./components/DialogHandler.vue"; > - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/providers/ColorSchemeProvider.ts b/src/providers/ColorSchemeProvider.ts new file mode 100644 index 0000000..424058d --- /dev/null +++ b/src/providers/ColorSchemeProvider.ts @@ -0,0 +1,15 @@ +import { SettingsContextStateKey } from "@/providers/SettingsContextProvider"; +import { useColorMode } from "@vueuse/core"; +import { injectStrict } from "@/lib/utils"; + +export default { + async setup() { + const { settings } = injectStrict(SettingsContextStateKey); + const colorMode = useColorMode(); + + colorMode.value = settings.value.appearance.colorScheme; + }, + render(): any { + return this.$slots.default(); + }, +};