@utility
- Functional Utility: How can I use theme colors as the argument value
#15892
Answered
by
wongjn
isaacgarc-dev
asked this question in
Help
-
I would like to make a functional utility that uses the theme colors as the argument value so I can style a container such: @utility scroll-bg-* {
&::-webkit-scrollbar-thumb {
background: --value(--scroll-bg-*, [percentage]);
}
} and use it like: <div class="scroll-bg-sky-500">
My Container
</div> So i can style the scrollbar dynamically depending the user theme and the behavior expected with accent colors where is important to note it and subtle colors when is obvious they can scroll it. |
Beta Was this translation helpful? Give feedback.
Answered by
wongjn
Jan 26, 2025
Replies: 1 comment
-
You could consider using @custom-variant scroll-thumb (&::-webkit-scrollbar-thumb); Which then allows you to use the existing colors that exist: <div class="scroll-thumb:bg-sky-500/50"> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
isaacgarc-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could consider using
@custom-variant
instead:Which then allows you to use the existing colors that exist: