Skip to content

How to set theme default to light? #3

Answered by kingyue737
ganjarsetia asked this question in Q&A
Discussion options

You must be logged in to vote

Nice catch! defaultTheme in vuetify config will always be overridden by useDark which uses system preferred color mode by default (dark in your case). You can remove defaultTheme 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:

const isDark = useDark({
+ writeDefaults: true,
+ initialValue: 'light',
  onChanged(dark: boolean) {
    theme.global.name.value = dark ? 'dark' : 'light'
  },
})

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kingyue737
Comment options

@ganjarsetia
Comment options

@kingyue737
Comment options

Answer selected by ganjarsetia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants