Skip to content

Dynamic/user-provided theme colors are not applied #5657

Open

Description

@KazimirPodolski

Environment

│ ╭── Nuxt project info ───────────────────────────────────────────────────────╮
│ │                                                                            │
│ │  Operating system      Linux 6.17.2-061702-generic                         │
│ │  CPU                   AMD Ryzen 7 5700G with Radeon Graphics (16 cores)   │
│ │  Node.js version       v22.15.0                                            │
│ │  nuxt/cli version      3.31.2                                              │
│ │  Package manager       pnpm 10.25.0                                        │
│ │  Nuxt version          4.2.2                                               │
│ │  Nitro version         2.12.9                                              │
│ │  Builder               vite 7.2.6                                          │
│ │  Config                -                                                   │
│ │  Modules               -                                                   │
│ │                                                                            │
│ ╰────────────────────────────────────────────────────────────────────────────╯

Is this bug related to Nuxt or Vue?

Vue

Package

v4.x

Version

v4.2.1

Reproduction

https://codesandbox.io/p/devbox/blue-pond-v8pj28 - the button must be red, not green.

vite.config.ts:

{
  ui: {
    colors: {
      primary: "custom", // our new dynamic user-selected color will be called "custom"
      neutral: "slate"
    },
  },
}

main.css: --color-green-* ---> --color-custom-*.

index.vue: a custom :style="..." imitating dynamic application of a color defined in runtime.

Description

Currently if you define a custom color, use it for ui.colors.*, and try to update it in runtime, then new value is not being picked up.

Basically, how to achieve dynamic/user-provided colors like here (it's from this article) with Nuxt UI?

I suspect the issue is with CSS variables not being "transitive":

  • Nuxt UI defines --ui-color-primary-50: var(--color-custom-primary-50, ); on :root
  • A developer defines --color-custom-primary-50: oklch(0.742188 0.151562 20) on some element
  • Oopsie Daisy! --ui-color-primary-50 is NOT set to oklch(0.742188 0.151562 20) on the element and descendants; you gotta set --ui-color-primary-50 directly which defeats the whole purpose of having a custom color

In other words, --A: var(--B); --B: var(--C); only sets A to the value of C when it all happens in one "compile"-time context. CSS experts please clarify if I'm making nonsense.

Additional context

I saw #3914 but this is IMO a bug and this one is more generic.

Also I'm not 100% sure I'm setting it up correctly and it's not a configuration issue.

Logs

Activity

  1. added
    bugSomething isn't working
    triageAwaiting initial review and prioritization
    on Dec 11, 2025
  2. Shooteger commented on Dec 12, 2025

    @Shooteger

    I think you setup is wrong, check this section here specifically in the docs: https://ui.nuxt.com/docs/getting-started/theme/design-system#extend-colors

  3. KazimirPodolski commented on Dec 12, 2025

    @KazimirPodolski
    ContributorAuthor

    @Shooteger I don't thing this applies because I'm not changing the set of semantic colors, I change the set of specific ones.

  4. github-actions commented on Feb 11, 2026

    @github-actions
    Contributor

    Hi! 👋 This issue has been open for 60 days without activity and will be closed in 7 days. Please comment if it's still relevant.

  5. alanscodelog commented on Feb 11, 2026

    @alanscodelog

    This is still relevant. Although I'm not sure how you would structure this different except for allowing some helper like 3914 requests. Having to override just a section of an application is rare, but in those cases maybe components can be wrapped in some sort of theme provider. In my non-nuxt ui apps, this is what i do to get dynamic theming, theme does not live in root but in the provider component and is reactive to a given theme prop.

    Also looking at the repro, there's a an even worse annoyance. Even if you were to set --ui-color-primary-* you will not get what you want. You need to set --ui-primary. Button actually looks at --ui-primary which points to --ui-color-primary-* (both on the :root) so a local --ui-color-primary-* override is not "in scope".

  6. github-actions commented on Apr 13, 2026

    @github-actions
    Contributor

    Hi! 👋 This issue has been open for 60 days without activity and will be closed in 7 days. Please comment if it's still relevant.

  7. KazimirPodolski commented on Apr 13, 2026

    @KazimirPodolski
    ContributorAuthor

    Bump.

  8. added
    v5#6918
    and removed
    triageAwaiting initial review and prioritization
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v5#6918

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions