Bring back extend.xyz support in Tailwind CSS v4 #16105
-
In my current project, we have colors that are only meant for text and background and shouldn't be part of the main colors object. In Tailwind v3, we were able to extend textColor and backgroundColor separately using the extend option in tailwind.config.js, like this:
However, in Tailwind CSS v4, this option no longer seems to work. Instead, the only alternative appears to be defining each color manually inside @layer utilities in CSS:
This raises a few concerns:
Would love to get clarification on whether extend.textColor and extend.backgroundColor are officially deprecated, or if there's another method we should be using in v4. Thanks in advance for any insights! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There is an alternative way to do this in v4: @theme {
--text-color-primary: var(--p-color-text-primary);
--text-color-secondary: var(--p-color-text-secondary);
--background-color-soft: var(--p-color-background-soft);
--background-color-highlight: var(--p-color-background-highlight);
}
Yes, we don't have the full JavaScript language constructs available in CSS.
See above. |
Beta Was this translation helpful? Give feedback.
There is an alternative way to do this in v4:
Yes, we don't have the full JavaScript language constructs available in CSS.
See above.