forked from BRETT/BRETT
18 lines
608 B
TypeScript
18 lines
608 B
TypeScript
export const THEME_NAMES = ['standard', 'discord', 'cyberpunk', 'spring', 'terminal', 'infoseer', 'homebrew', 'florense', 'kawi-green', 'clonz', 'clawmorphism', 'realmorphism', 'amber', 'sunny-sprout', 'spotify', 'nordic', 'ss', 'amethyst-haze', 'deep-wine', 'my-claude', 'neo'] as const
|
|
|
|
export type ThemeName = typeof THEME_NAMES[number]
|
|
|
|
export function useTheme() {
|
|
const theme = useCookie<ThemeName>('color-mode', {
|
|
default: () => 'standard',
|
|
maxAge: 60 * 60 * 24 * 365,
|
|
sameSite: 'lax',
|
|
})
|
|
|
|
if (!THEME_NAMES.includes(theme.value)) {
|
|
theme.value = 'standard'
|
|
}
|
|
|
|
return theme
|
|
}
|