kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
24 wiersze
468 B
TypeScript
24 wiersze
468 B
TypeScript
import { useColorMode, usePreferredDark } from '@vueuse/core'
|
|
import { computed } from 'vue'
|
|
|
|
const theme = useColorMode({
|
|
selector: 'body',
|
|
modes: {
|
|
auto: '',
|
|
light: 'theme-light',
|
|
dark: 'theme-dark'
|
|
},
|
|
emitAuto: true
|
|
})
|
|
|
|
const preferredDark = usePreferredDark({ window })
|
|
const selectedTheme = computed(() => theme.value === 'auto'
|
|
? preferredDark.value ? 'dark' : 'light'
|
|
: theme.value
|
|
)
|
|
|
|
export default () => ({
|
|
theme,
|
|
selectedTheme
|
|
})
|