init: чистый старт Laravel + Vuexy
This commit is contained in:
13
resources/ts/@core/utils/vuetify.ts
Normal file
13
resources/ts/@core/utils/vuetify.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { LiteralUnion } from 'type-fest'
|
||||
import { cookieRef } from '@layouts/stores/config'
|
||||
|
||||
export const resolveVuetifyTheme = (defaultTheme: LiteralUnion<'light' | 'dark' | 'system', string>): 'light' | 'dark' => {
|
||||
const cookieColorScheme = cookieRef<'light' | 'dark'>('color-scheme', usePreferredDark().value ? 'dark' : 'light')
|
||||
const storedTheme = cookieRef('theme', defaultTheme).value
|
||||
|
||||
return storedTheme === 'system'
|
||||
? cookieColorScheme.value === 'dark'
|
||||
? 'dark'
|
||||
: 'light'
|
||||
: storedTheme as 'light' | 'dark'
|
||||
}
|
||||
Reference in New Issue
Block a user