Scope colors to specific properties #16312
Closed
dsmikeyorke
started this conversation in
Ideas
Replies: 3 comments 1 reply
-
This is already available in Tailwind: @theme {
--text-color-subtle: hsl(var(--text-subtle));
--text-color-primary: hsl(var(--text-primary));
} Though the "root" @utility text {
color: hsl(var(--text-default));
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
@wongjn amazing! Thanks for the quick response. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Nice! Is this documented @wongjn? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First off, our team is loving the Tailwind v4 release!
One feature request we’d like to see implemented is the ability to scope colors to specific properties like backgrounds, text, and borders, etc. In v3, we were able to achieve this using the following code:
This allowed us to scope colors specifically to the text property, eliminating confusion and ensuring perfect alignment with our design system. Without scoped colors, we now have to prefix each color with the corresponding property, resulting in class names like
text-text-subtle
orbg-bg-primary
. This also increases the number of options considerably in the suggestions popover in our code editor.Adding this feature would be a game-changer for our projects and would be greatly appreciated!
If this isn’t something you see in Tailwind’s future, do you have any suggestions for a better approach?
Beta Was this translation helpful? Give feedback.
All reactions