Custom Colors in Nuxt UI v3
Hello,
I'm trying out Nuxt UI v3 now and I'm not able to introduce new colors like I've done in v2.
In v2 I just have done the following:
tailwind.config.ts:
app.config.ts:
Does anyone have an idea how I could resolve the issue?
4 Replies
Hi @Ponkhy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In Nuxt UI v3, the approach to custom colors has changed due to the migration to Tailwind CSS v4, which now follows a CSS-first configuration approach. Here's how you can implement your custom color in Nuxt UI v3:
1. First, remove your
tailwind.config.ts
file as it's no longer needed in the same way.
2. Instead, create or update your CSS file (typically in assets/css/main.css
) and use the @theme
directive to define your custom colors:
3. Make sure to import this CSS file in your nuxt.config.ts
:
4. Then update your app.config.ts
to use the new color:
Note that in Nuxt UI v3, the gray
property has been renamed to neutral
, and the configuration structure has changed slightly.
This approach follows the CSS-first theming introduced in Nuxt UI v3 as documented in the UI Pro Docs Migration guide.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@178121051497168896> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
It doesn't work, the following element does not have the newcolor:
Also what is the difference between these?
@import 'tailwindcss' theme(static);
@import 'tailwindcss';