[v4] Ability to fallback to hex colors. #16392
Replies: 2 comments
-
Also this might just be a bug, but I tried to use the |
Beta Was this translation helpful? Give feedback.
-
Before Tailwind CSS v4, we used tailwind.config.js, where you could set up your OKLCH colors. With the help of postcss.config.js and the @csstools/postcss-oklab-function plugin, fallback hex colors were automatically generated. Now, with CSS variables, achieving this has become much more difficult for me, I have not being able to find a solution. I hope we find a more reliable solution rather than relying on a manual setup. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've read a few issues where it seems pretty clear that library is trying to put an aggressive foot forward towards the future by using
oklch
colors. I agree, it's a great concept and I think that it makes sense from that perspective.The flip side is that I spent most of my day yesterday trying to identify a display bug in Chrome (latest) which caused background colors to show multiple tints when an SVG was present on the page.
Now, I know this is not really a Tailwind bug, in the sense that Chrome does not really support
oklch
in a bug-free manner. However, the discussions I read suggested: Just use the mappings from Tailwind 3. So I did that, and it did solve my display bug in Chrome, but the code rubbed me the wrong way. Here's a snippet:My request is an either-or here:
Can there be some sort of guide for users who want to upgrade their library but have support for browsers that do not implement
oklch
or for browsers (like Chrome) that supportoklch
but not in a bug free manner? I had to dig through the closed issues to find someone else that had an issue withoklch
, and from that I deduced that there was a recommended "solution" which is the code I posted above.Can we have a fallback API instead? For example, I'd much prefer to do this:
I would much prefer to use the tailwind APIs to reference theme variables than to start spraying
var(--the-var)
all over my spreadsheet.Beta Was this translation helpful? Give feedback.
All reactions