Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

feat(module): support extra per-mode classes on <html> via ui.colorMode

Open
#7,014 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
tailwindcss, typescript

Research direction

The change involves the color mode integration in the Nuxt UI module. Start by examining the module's configuration handling, likely in src/module.ts or a dedicated color mode integration file. Look for where ui.colorMode is processed and how it interacts with @nuxtjs/color-mode. The proposal requires extending the configuration type to accept ColorModeOptions and forwarding the extraClass setting. Test by modifying the configuration and checking the generated HTML class on the client.

Written by the indexing model from the issue text.

Description

Description

When using a third-party palette keyed on flavor classes (e.g. Catppuccin .latte / .mocha) alongside Nuxt UI, <html> needs both the mode class and the flavor class:

<html class="light latte">
<html class="dark mocha">

There's no config for this today. Toggling the class in a client plugin works, but it flashes on first paint because it runs after color mode's inline script.

Proposal

Accept it through the existing color mode integration and forward it:

// nuxt.config.ts
export default defineNuxtConfig({
  ui: {
    colorMode: {
      extraClass: { light: ['latte'], dark: ['mocha'] },
    },
  },
})
  • Nuxt: forward to @nuxtjs/color-mode, which needs upstream support: nuxt-modules/color-mode#321
  • Vue: map to VueUse useColorMode({ modes }), which already supports space-separated classes (modes: { dark: 'dark mocha' })

ui.colorMode is a boolean today, so accepting boolean | ColorModeOptions keeps this additive and v4-able:

type ClassNameInput = string | readonly string[]

interface ColorModeOptions {
  extraClass?: Readonly<Partial<Record<'light' | 'dark', ClassNameInput>>>
}

type UiColorModeOption = boolean | ColorModeOptions

It belongs in nuxt.config rather than app.config, because the no-flash script is generated from module options at build time.

Additional context

Related to the multi-theme direction in #6610 (Epic A6, [data-theme] blocks).

Dominant language
TypeScript
Stars
7k
Forks
1.1k
Avg merge
1d 17h
Merged PRs (30d)
170

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nuxt/ui

All issues in nuxt/ui

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.