Replies: 2 comments 5 replies
-
Related:
Based on the linked documentation, I would structure your code like this in v4: @import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
@custom-variant sky-light (&:where(.sky-light, .sky-light *));
@custom-variant sky-dark (&:where(.sky-dark, .sky-dark *));
@theme {
--color-app-background: hsl(210 20% 98%);
}
@layer theme {
:root, :host {
@variant dark {
--color-app-background: hsl(216 13% 15%);
}
@variant sky-light {
--color-app-background: hsl(210 20% 98%);
}
@variant sky-dark {
--color-app-background: hsl(216 13% 15%);
}
}
} Of course, you can use OKLCH colors instead of HSL colors - I just didn't feel like converting them. Themes:
I don't want to repeat myself too much since there are already plenty of write-ups about this on GitHub and Stack Overflow. In v4, the JS config was removed, so to switch the |
Beta Was this translation helpful? Give feedback.
-
Your suggestion does not show how it addresses the following:
How would that work with what you suggested? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my Next.js 15/TailwindCSS v3 app i have 11 themes. 5 dark ones and 6 light ones. I'm planning on upgrading to TailwindCSS v4.
The structure looks likes this:
How would this look in v4?
Something like this?
Should I use
@layer theme
or@layer base
to put:root
,.dark
,.sky_light
,.sky_dark
, etc ?Is nesting variables in properties in
@layer theme
legal?Beta Was this translation helpful? Give feedback.
All reactions