nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.08k stars 99 forks source link

Limit allowed color modes to a set of values (whitelist) #194

Open Pyrodash opened 1 year ago

Pyrodash commented 1 year ago

Is your feature request related to a problem? Please describe.

Yes, since the user's preferred color mode is stored in localStorage, it can be modified manually with a theme which does not exist, rather than falling back to one which does.

Describe the solution you'd like

I believe it would be helpful if there could be an array whitelist for allowed themes/color modes in the module's configuration, and when the parsed preference is not any of them, the library can reset the user's preference to the configured fallback.