Packages

@nuxtjs/color-mode

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

Your version

3.0.0

major16 Feb 2022Where it was published

3.5.2 is the newest release of 3.x.

In short

4 breaking5 changed

  • Breaking

    Use esbuild to 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:

  • Breaking

    The $colorMode helper 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.

Release note

v3 of @nuxtjs/color-mode requires either Nuxt Bridge or Nuxt 3. If you are using Nuxt 2 without Bridge, you should continue to use v2.

Notable changes

  1. Uses @nuxt/module-builder to build module.

  2. Refactor structure (lib -> src/dist, templates -> runtime)

  3. Rewrite in TypeScript

  4. Move from templating options to creating a virtual module for greater performance

  5. Breaking

    Use esbuild to minify the script - note: ⚠️ it's likely this raises the minimum browser target ⚠️

Migration

  1. 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 definePageMeta but instead continue using the component option colorMode.

  2. Breaking

    The $colorMode helper remains the same, but there is also a new composable (useColorMode) which is the recommended way of accessing color mode information.

  3. Breaking

    If you were directly importing color mode configuration types, note that this has been renamed to ModuleOptions.

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.