mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-06-01 12:44:32 -04:00
feat: persistent theme selection fallback to prefered theme
This commit is contained in:
parent
d542688664
commit
40e9af06cf
@ -1,5 +1,13 @@
|
|||||||
|
import { useStorage, usePreferredDark } from '@vueuse/core';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
export const useStyleStore = defineStore('style', () => ({
|
export const useStyleStore = defineStore('style', {
|
||||||
isDarkTheme: true,
|
state: () => {
|
||||||
}));
|
const isDark = usePreferredDark();
|
||||||
|
|
||||||
|
return {
|
||||||
|
isDarkTheme: useStorage('useDarkTheme', isDark) as Ref<boolean>,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user