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

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

No files matched your search

+2 -1
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')
}
}
}