-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
What version of Tailwind CSS are you using?
v3.4.13
What build tool (or framework if it abstracts the build tool) are you using?
Tested with Bud.js 6.23.3 (using postcss 8.4.24) and Tailwind Playground.
What version of Node.js are you using?
v20.16.0
What browser are you using?
N/A
What operating system are you using?
macOS Sonoma 14.7
Reproduction URL
https://play.tailwindcss.com/dDmsole8X3
Describe your issue
When colors are added to a Tailwind config using the standard oklch() function, the resulting color classes do not work with Tailwind's methods of controlling opacity. For a color like primary: "oklch(68% 0.15 237.33)", these two issues appear:
- The simple color classes generated are missing the opacity properties like
var(--tw-bg-opacity)andvar(--tw-text-opacity)— it seems that Tailwind just copies the value directly. - Tailwind completely fails to generate modified-opacity classes for these colors, like
bg-primary/50.
The same problems occur if I explicitly declare an opacity in the color definition: primary: "oklch(68% 0.15 237.33 / 1)".
Classes ARE generated correctly if I use the <alpha-value> placeholder in color definitions: primary: "oklch(68% 0.15 237.33 / <alpha-value>)". However, this magic is not explained anywhere in Tailwind's color documentation: https://tailwindcss.com/docs/customizing-colors
The playground link shows both issues and contrasts the correct behavior of colors defined using rgb(r g b / a) notation.