Replies: 1 comment 5 replies
-
Assuming I'm understanding you correctly and the @layer theme {
* {
@variant dark {
--color-primary: theme(--color-blue-200);
}
}
} https://play.tailwindcss.com/SYEJ4bnAuH?file=css |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I create share themes to be used is dozens of MFEs, each defines their own prefix to avoid CSS load order conflicts.
The theme uses variants for dark color theme, for example.
I can do that in Tailwind v3, but in v4 there are 2 problems:
@custom-variant
cannot be nestedThis mean I can't add it to the share theme to specify the common variant mechanisms.
No theme mechanism to define variants
For example, I want the token
--color-primary
maps to--color-red-800
in light theme and--color-blue-800
in dark theme.The solutions I found are:
using class
using data-*
you can see that the
--tw-color-primary
and.tw-dark
also make the them not sharable/portable.Is there another way in Tailwind v4 that support this use case?
I have not only
@custom-variant dark
but also other variants, so the non-sharable part has a lot of definitions.Beta Was this translation helpful? Give feedback.
All reactions