Fix system theme not respecting preferred dark theme. (#1673)

This commit is contained in:
Prospector
2024-04-10 18:30:46 -07:00
committed by GitHub
parent 60727656c9
commit 5b1850e161
3 changed files with 16 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
await useAuth()
await useUser()
const themeStore = useTheme()
const cosmetics = useCosmetics()
nuxtApp.hook('app:mounted', () => {
if (process.client && themeStore.value.preference === 'system') {
@@ -12,7 +13,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
if (e.matches) {
updateTheme('light')
} else {
updateTheme('dark')
updateTheme(cosmetics.value.preferredDarkTheme ?? 'dark')
}
}
}