forced dark and light mode in 2 different projects
Version
@nuxtjs/color-mode: 3.5.2 nuxt: 3.17.3
it's not really a big of a problem, just wanted to report to see if it's normal or not.
so I have 2 projects. one project is forced on light mode and the other is forced on dark mode,
and I run these projects both on my localhost port 8000,
as you might expect, when I run first project (forced dark), my local storage would be set to dark and when I turn off this project and run the second project (forced light), it's still gonna be dark, I have to manually delete the localstorage to fix the issue.
The browser localStorage shares the same key-value across domains and subdomains, so the nuxt-color-mode localstorage key applies globally.
You can use the storageKey option in your nuxt.config.ts to set a unique localstorage key for nuxt-color-mode per project.
export default defineNuxtConfig({
...
colorMode: {
storageKey: 'nuxt-color-mode-app1' // change this per project
}
})
Cool ! but isn't it better that when we force a color mode and run the project, the code clears that storage ? my problem is solved but I think it would be a good update
Cool ! but isn't it better that when we force a color mode and run the project, the code clears that storage ? my problem is solved but I think it would be a good update
Just ran into this. Thanks for the clarification. Agree with OP, would be nice to clear in dev server start