Closed
Description
What version of Tailwind CSS are you using?
v2.0.4
What version of Node.js are you using?
v14.16.0
What browser are you using?
N/A
What operating system are you using?
macOS
Reproduction repository
see body
I'm using HSL color definitions in a project instead of RGB/hex. With Tailwind 2.0, the hsl()
values in my tailwind.config.js get converted to rgba()
rules (so the opacity classes can work their dark magic). However, because HSL -> RGB isn't a simple add/subtract swap, the resulting CSS uses floats for each color channel:
// tailwind.config.js
module.exports = {
theme: {
colors: {
offblack: 'hsl(205,95%,2%)'
} } }
/* resulting CSS */
.text-offblack {
--tw-text-opacity: 1;
color: rgba(.2550000000000002,5.907499999999999,9.945,var(--tw-text-opacity));
}
The trouble with this is that browser support for floats in rgba wasn't good until the last couple years. That means people with older browsers (something like 5% of traffic) will see NO COLORS AT ALL on my site with Tailwind 2.0 — everything is black and white.
Can we make Tailwind keep HSL values and output hsla()
colors instead of rgba()
?
Originally posted by @andronocean in #3833
Metadata
Metadata
Assignees
Labels
No labels