diff --git a/src/stores/style.store.ts b/src/stores/style.store.ts index 7c2099c0..c11fde2d 100644 --- a/src/stores/style.store.ts +++ b/src/stores/style.store.ts @@ -1,5 +1,13 @@ +import { useStorage, usePreferredDark } from '@vueuse/core'; import { defineStore } from 'pinia'; +import type { Ref } from 'vue'; -export const useStyleStore = defineStore('style', () => ({ - isDarkTheme: true, -})); +export const useStyleStore = defineStore('style', { + state: () => { + const isDark = usePreferredDark(); + + return { + isDarkTheme: useStorage('useDarkTheme', isDark) as Ref, + }; + }, +});