[v4] Custom @utility with color/alpha #16167
Unanswered
jamiebuilds-signal
asked this question in
Help
Replies: 2 comments
-
I haven't found a technique to reduce the number of properties, but at least reduced to one @utility scrollbar-* {
--alpha: calc(--modifier(integer) * 1%);
scrollbar-color: --alpha(--value(--color-*, [color]) / var(--alpha, 100%)) transparent;
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
A related discussion: #15775 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
I'm working on custom
scrollbar-*
utility using the new CSS@utility
syntax:I want it to work the same way as built-in color utils like
text-*
orbg-*
and support alpha values liketext-black/50
:Problem
Right now this is the closest thing I can actually get working:
Which generates the following:
But I don't like that this produces multiple declarations, I'd like to find a way to only produce the one.
Also, this doesn't work particularly well with the vscode plugin with intellisense, I think because the new theme
--custom-properties
don't have an opacity scale, there's nothing to reference here.Ideally I would like a simpler way to be able to create colors utils that work just like the built-in ones, with support for other named values like
scrollbar-transparent
.Beta Was this translation helpful? Give feedback.
All reactions