Packages

@nuxtjs/color-mode

4.1.0 · 27 Oct 2026MIT1.3M / weekRepositoryHomepagenpmAtom feed

Your version

2.0.0

major13 Oct 2020Where it was published

2.1.1 is the newest release of 2.x.

In short

1 breaking2 changed

  • Breaking

    ⚠️ The breaking change is only if you are using the cookie option in the V1, if you don't use it, you can upgrade easily.

Release note

Notes

  • Breaking

    ⚠️ The breaking change is only if you are using the cookie option 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 colorMode property:

<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.forced value.

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 cookie package.

To customize the storage key, you now have to use the storageKey property instead of cookie.key.

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.