How to set theme default to light? #3
Answered
by
kingyue737
ganjarsetia
asked this question in
Q&A
-
I tried to change vuetify.ts to So how to set theme default to light? Nice template btw 👍 |
Beta Was this translation helpful? Give feedback.
Answered by
kingyue737
Aug 5, 2024
Replies: 1 comment 3 replies
-
Nice catch! To set theme default to light on a system preferring dark, you can add following in AppBar.vue: const isDark = useDark({
+ writeDefaults: true,
+ initialValue: 'light',
onChanged(dark: boolean) {
theme.global.name.value = dark ? 'dark' : 'light'
},
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ganjarsetia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice catch!
defaultTheme
in vuetify config will always be overridden byuseDark
which uses system preferred color mode by default (dark in your case). You can removedefaultTheme
in vuetify.ts which does not take effect.To set theme default to light on a system preferring dark, you can add following in AppBar.vue: