19 lines
405 B
TypeScript
19 lines
405 B
TypeScript
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 }
|
|
}
|