@nuxtjs/color-mode
4.1.0 · 27 Oct 2026MIT1.3M / weekRepositoryHomepagenpmAtom feed
48 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 4.x · latest line
4.1.0
27 Oct 2026Support
@nuxt/vite-serverSupport nuxt v5
Allow cookieAttrs to be set and overridden via runtime config
v4.1.0 is the next minor release.
Changelog
Enhancements
Support
@nuxt/vite-serverSupport nuxt v5
Allow cookieAttrs to be set and overridden via runtime config
Performance
Defer non-critical client plugin work until after hydration
Fixes
4.0.1
9 Jun 2026Add cookie attributes
Avoid optional chaining
Client crash when disabled cookies and storage
Features
Add cookie attributes
Bug Fixes
Avoid optional chaining
Client crash when disabled cookies and storage
Set helper on window in testing
Cookie parsing
Performance
Tree-shake unused cookie preference code from plugin
4.0.0
11 Nov 2025- Breaking
Drop default classSuffix
- Breaking
Move to
typesVersions, bump dependencies, and drop cjs support - Breaking
Disallow setting
colorMode.value+ test types
Migration Guide
Breaking Changes
- Breaking
Drop default classSuffix
- Breaking
Move to
typesVersions, bump dependencies, and drop cjs support - Breaking
Disallow setting
colorMode.value+ test types - Breaking
Remove defunct
hidoption - Breaking
deps: Update nuxt/kit to v4 + drop support for bridge
Bug Fixes
Remove more code supporting nuxt 2/bridge
Remove legacy type augmentations
Stub helper utility with no-ops in test mode
Remove more legacy support for vue 2
Apply cookie to root path, not subpath
Performance
Use
exsolveto resolvetailwindcss
- 3.x
3.5.2
24 Oct 20243.5.1
14 Sep 2024Synchronize Vue 2 & 3 component behaviour
3.5.0
13 Sep 2024placeholderslot for<ColorScheme>componentcookiestorage
3.4.4
16 Aug 2024Augment vue rather than @vue/runtime-core
3.4.2
24 Jun 2024Remove newline at end of minified script
3.4.1
26 Apr 2024Add tilde to css selector for tailwind integration
3.4.0
11 Apr 2024Add disableTransition option
Automatic integration with @nuxtjs/tailwindcss
Enhancements
Add disableTransition option
Automatic integration with @nuxtjs/tailwindcss
3.3.3
19 Mar 2024Use minimiser for window.localStorage
Remove lodash.template usage
3.3.2
15 Nov 20233.1.6
22 Sep 2022Inject color-mode script with nitro plugin (handles mixed spa/ssr)
3.1.5
9 Sep 2022Color mode in server
What's Changed
Color mode in server
3.1.4
9 Jun 2022Works with ssr: false
3.1.3
31 May 2022Handle data attribute in script as well
3.1.2
31 May 2022Add missing imports in client-plugin
3.1.1
31 May 20223.1.0
31 May 2022Add support for
data-*attribute in<html>tag
What's Changed
Add support for
data-*attribute in<html>tag
3.0.3
10 May 2022Rename useMeta to useHead
plugin: Prevent infinite loop on watch
What's Changed
Rename useMeta to useHead
plugin: Prevent infinite loop on watch
3.0.2
7 Mar 20223.0.1
21 Feb 2022Move script to head and set forced color mode on
<html>element
3.0.0
16 Feb 2022- Breaking
Use
esbuildto minify the script - note: ⚠️ it's likely this raises the minimum browser target ⚠️ - Breaking
The main change between Nuxt 2 -> Nuxt 3 is that you will define your color mode at the page level with
definePageMeta:<template> <h1>This page is forced with light mode</h1> </template> <script> - export default { - colorMode: 'light', - } + definePageMeta({ + colorMode: 'light', + }) </script>⚠️ If you are using Nuxt Bridge, you should not use
definePageMetabut instead continue using the component optioncolorMode. - Breaking
The
$colorModehelper remains the same, but there is also a new composable (useColorMode) which is the recommended way of accessing color mode information.
v3 of
@nuxtjs/color-moderequires either Nuxt Bridge or Nuxt 3. If you are using Nuxt 2 without Bridge, you should continue to use v2.Notable changes
Uses
@nuxt/module-builderto build module.Refactor structure (
lib->src/dist,templates->runtime)Rewrite in TypeScript
Move from templating options to creating a virtual module for greater performance
- Breaking
Use
esbuildto minify the script - note: ⚠️ it's likely this raises the minimum browser target ⚠️
Migration
- Breaking
The main change between Nuxt 2 -> Nuxt 3 is that you will define your color mode at the page level with
definePageMeta:<template> <h1>This page is forced with light mode</h1> </template> <script> - export default { - colorMode: 'light', - } + definePageMeta({ + colorMode: 'light', + }) </script>⚠️ If you are using Nuxt Bridge, you should not use
definePageMetabut instead continue using the component optioncolorMode. - Breaking
The
$colorModehelper remains the same, but there is also a new composable (useColorMode) which is the recommended way of accessing color mode information. - Breaking
If you were directly importing color mode configuration types, note that this has been renamed to
ModuleOptions.
- 2.x
2.0.4
3 Mar 2021Types compatible with nuxt-property-decorator
2.0.2
4 Dec 2020type-defs: make all options optional
2.0.1
2 Dec 2020type-defs: add types reference to package
2.0.0
13 Oct 2020- Breaking
⚠️ The breaking change is only if you are using the
cookieoption in the V1, if you don't use it, you can upgrade easily. 📘 Read the updated documentation
🎮 Checkout the updated demo
Notes
- Breaking
⚠️ The breaking change is only if you are using the
cookieoption in the V1, if you don't use it, you can upgrade easily. 📘 Read the updated documentation
🎮 Checkout the updated demo
Force a color mode
You can force the color mode at the page level (only parent) by setting the
colorModeproperty:<template> <h1>This page is forced with light mode</h1> </template> <script> export default { colorMode: 'light', } </script>This feature is perfect for implementing dark mode to a website incrementally by setting the non-ready pages to
colorMode: 'light'.We recommend to hide or disable the color mode picker on the page since it won't be able to change the current page color mode, using
$colorMode.forcedvalue.See example: color-mode.nuxtjs.app/light
Local Storage only
This will also fixes #38
Using a cookie is only worth for doing server-side rendering with no cache, where actually localStorage work in every-case and won't lead to a flash on client-side anyway.
This also simplify the options and reduce the dependency with the
cookiepackage.To customize the storage key, you now have to use the
storageKeyproperty instead ofcookie.key.- 1.x
1.1.1
15 Sep 2020types: add new options and include in package
- 0.0.x
0.0.2
15 Apr 20200.0.1
15 Apr 2020Reading the note…
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.