Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is my nuxt app color mode configuration not working with the "prefrence : light" ? #262

Open
amirsafaricg opened this issue May 8, 2024 · 5 comments
Labels
question Further information is requested

Comments

@amirsafaricg
Copy link

this is my nuxt color mode config in nuxt.config.ts:

colorMode: { classSuffix: '', preference: 'light', fallback: 'light', },

its starting always by default dark mode. how Can i fix it and put the prefrence on system ?

@amirsafaricg amirsafaricg added the question Further information is requested label May 8, 2024
@NenoSun
Copy link

NenoSun commented Jun 23, 2024

I am also having the same issue.

@akncnkoc
Copy link

i am also having the same issue

@MuhammadM1998
Copy link

TLDR: Try removing color-mode cookie and it should work fine

Just faced this issue and the problem that there was already a color mode cookie with value=system (the default). It looks like the module only creates the cookie if there's none while it should always override it or override when the cookie value != preference.

@damisparks
Copy link

It is related to #263

Recommendation

Ideally, you'd like to dark mode by default, Here is what your config should look like.
The solution works for me.

export default defineNuxtConfig({
  colorMode: {
    preference: 'dark',
    fallback: 'dark'
  }
})

Note 💡

If you're stuck in light mode even after changing this setting, you might need to remove the nuxt-color-mode entry from your browser's local storage.

@liuzhch1
Copy link

Remove the nuxt-color-mode in local storage works! Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants