Using the <alpha-value> of config file in TW4 #16667
Replies: 3 comments 10 replies
-
|
You don't need |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone. Important Context: While the example below specifically uses PrimeNG, this is a systemic architectural issue. It affects any UI library or custom design system (including The ProblemIn Tailwind v4, whenever I use the slash syntax for opacity (e.g., @supports (color: color-mix(in lab, red, red)) {
.bg-primary-500\/10 {
background-color: color-mix(in oklab, var(--p-primary-500) 10%, transparent);
}
}Because Context & Attempted SolutionsI am trying to maintain a workflow where:
I want to write Here is what I’ve tried to bypass Attempt 1: Using
|
Beta Was this translation helpful? Give feedback.
-
|
Short version: I don't think there is a supported v4 equivalent of Looking at the v4 source, opacity modifiers are centralized through color-mix(in oklab, <value> <alpha>, transparent)Also, the compatibility path that imports JS config values replaces So for your PrimeNG / older-browser case, the practical choices are basically:
<div class="bg-[hsl(var(--hsl-primary-500)_/_0.1)]"></div>
@utility bg-primary-500-a10 {
background-color: hsl(var(--hsl-primary-500) / 0.1);
}
@utility text-primary-500-a80 {
color: hsl(var(--hsl-primary-500) / 0.8);
}
So your "ugly workaround" is unfortunately close to the current supported escape hatch if legacy browsers matter. If the goal is to preserve v3-style channel variables with |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
To my follow Tailwinders, please assist:
When upgrading to Tailwind 4, is it possible to use a equivalent as used in the tailwind.config file, in the definition of custom color CSS variables in the main CSS file where Tailwind is imported?
Since is a config file construct, how is it supported in TW4? Or do you need still need a config file for such cases?
Some insights will be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions