File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
packages/example/src/plugins Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import { aliases as appFaAliases } from '../icons/fa';
1818import { aliases as appMdiAliases } from '../icons/mdi' ;
1919import { useAppStore } from '../store' ;
2020import { themes } from './themes' ;
21+ import { getLightDarkTheme } from '@chobantonov/jsonforms-vuetify-renderers' ;
22+ import { useMediaQuery } from '@vueuse/core' ;
2123
2224function toIconSetAliases ( iconset : string ) {
2325 // we can add vue-vuetify icons setoverrides here if needed or use the default provided base on the iconset
@@ -94,9 +96,19 @@ function createVuetifyInstance(appStore: ReturnType<typeof useAppStore>) {
9496 if ( ! themeNames . includes ( defaultTheme ) ) {
9597 defaultTheme =
9698 appStore . dark === undefined ? 'system' : appStore . dark ? 'dark' : 'light' ;
97- }
9899
99- appStore . theme = defaultTheme ;
100+ if ( defaultTheme === 'system' ) {
101+ const isPreferredDark = useMediaQuery ( '(prefers-color-scheme: dark)' ) ;
102+
103+ appStore . theme = getLightDarkTheme (
104+ appStore . dark ?? isPreferredDark . value ,
105+ appStore . theme ,
106+ ( theme ) => themeNames . includes ( theme ) ,
107+ ) ;
108+ } else {
109+ appStore . theme = defaultTheme ;
110+ }
111+ }
100112
101113 return createVuetify ( {
102114 components,
You can’t perform that action at this time.
0 commit comments