Repository navigation
Description
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-50is NOT set tooklch(0.742188 0.151562 20)on the element and descendants; you gotta set--ui-color-primary-50directly 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.
Activity
Shooteger commentedon Dec 12, 2025
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
KazimirPodolski commentedon Dec 12, 2025
@Shooteger I don't thing this applies because I'm not changing the set of semantic colors, I change the set of specific ones.
github-actions commentedon Feb 11, 2026
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.
alanscodelog commentedon Feb 11, 2026
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-primarywhich points to--ui-color-primary-*(both on the :root) so a local--ui-color-primary-*override is not "in scope".github-actions commentedon Apr 13, 2026
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.
KazimirPodolski commentedon Apr 13, 2026
Bump.