Replies: 1 comment
-
|
Hey! The Do you only want to have this utility available for For example, you could setup a @theme {
--column-rule-color-current: currentColor;
}
@utility rule-col-* {
column-rule-color: --value(--column-rule-color-*);
column-rule-color: --alpha(--value(--column-rule-color-*) / calc(--modifier(integer) * 1%));
column-rule-color: --alpha(--value(--column-rule-color-*) / --modifier([percentage]));
}This way any color in that namespace will be exposed. You can then map a name like If you want to re-use the default @theme {
--color-current: currentColor;
}
@utility rule-col-* {
column-rule-color: --value(--color-*);
column-rule-color: --alpha(--value(--color-*) / calc(--modifier(integer) * 1%));
column-rule-color: --alpha(--value(--color-*) / --modifier([percentage]));
}If you're only interested in the @utility rule-col-current-* {
column-rule-color: --value(--default(currentColor));
column-rule-color: --alpha(--value(--default(currentColor)) / calc(--modifier(integer) * 1%));
column-rule-color: --alpha(--value(--default(currentColor)) / --modifier([percentage]));
}The idea here is that the value is optional, so therefore you can use Let me know if this works for you. If your use case is a bit different, let me know and we'll get to a better solution instead. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I try to create a utility class with current color and opacity support
Here's a demo:
https://play.tailwindcss.com/bsNQbZU4Pl?file=css
But it isn't working. I try so many different ways, has anyone a clue?
Beta Was this translation helpful? Give feedback.
All reactions