Move to appConfig, Vuetify 3
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
|
||||
export function useCustomTheme() {
|
||||
const { $vuetify } = useNuxtApp()
|
||||
|
||||
const isDark = useDark({
|
||||
valueDark: 'dark',
|
||||
valueLight: 'light',
|
||||
initialValue: 'light',
|
||||
onChanged: (dark: boolean) => {
|
||||
$vuetify.theme.global.name.value = dark ? 'dark' : 'light'
|
||||
},
|
||||
})
|
||||
|
||||
const toggle = useToggle(isDark)
|
||||
|
||||
return { isDark, toggle }
|
||||
}
|
||||
Reference in New Issue
Block a user