12 lines
359 B
TypeScript
12 lines
359 B
TypeScript
/** Apply saved theme before paint to reduce flash (pairs with useAppTheme). */
|
|
export default defineNuxtPlugin(() => {
|
|
try {
|
|
const t = localStorage.getItem('policy-ui.theme.v1')
|
|
if (t && ['light', 'purple', 'dark', 'dark-purple'].includes(t)) {
|
|
document.documentElement.setAttribute('data-theme', t)
|
|
}
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
})
|