CSS Variables and Color Space Modifiers #10619
Replies: 4 comments 5 replies
-
This really needs to be fixed as breaks important feedback loop when working with colors and UI tools like shadcn UI. |
Beta Was this translation helpful? Give feedback.
-
we found an workaround for this issue. Duplicate variables where the above is in |
Beta Was this translation helpful? Give feedback.
-
@adamwathan - is there a reason why the color space functions have to be used in the config files instead of css files? |
Beta Was this translation helpful? Give feedback.
-
@edwinvelez this should be the accepted answer for the moment, until Tailwind V4 is live |
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.
-
Not too long ago there was Theming Tailwind with CSS Variables and its complimentary source code. Great!
According to Easier CSS variable color configuration and CSS Variables there is a minor update to the recommended solution. Awesome!
In either solution, there seems to be a problem. Because color space modifiers are not valid, the IDE does not know how to pick up on color codes when using numeric values only. Therefore, color previews do not show in the gutter. Additionally, refactoring becomes more tedious and prone to error.
If I misunderstand the correct usage and creating a non-existent issue, I look forward to your guidance.
According to documentation - WRONG!
According to documentation - RIGHT
The Main Question
It seems that
tailwind.config.js
generates values based on CSS Variables defined in:root
. To achieve this, we pass in an alternative specified by our limitation of using color space modifiers. Tailwind is already parsing strings with<alpha-value>
. Instead of the current approach, why not acceptrgb( )
values, without modification accepting color space modifiers, and parse the string as you already do with<alpha-value>
? If you can replace<alpha-value>
then you can striprgb( )
and continue with your manipulation.Beta Was this translation helpful? Give feedback.
All reactions