[v4] color-mix utilities #14827
Replies: 2 comments 1 reply
-
This feature would be great, however maybe the syntax would need to account for a few things:
For example, what would happen in this case: <!-- is the mix applied to bg or to text color ? -->
<button class="bg-sky-600 text-slate-50 hover:mix-black/10">Click me</button> Or, with an alternate syntax: <!-- Are the color modifiers used as alpha values or mix percentages ? -->
<button class="bg-sky-600 text-slate-50 hover:bg-sky-600/75-mix-black/10">Click me</button> |
Beta Was this translation helpful? Give feedback.
-
The color-mix plugin in #13085 is broken in v4 because it can no longer capture I briefly tried working around the issue, but sadly found that default plugins cannot be extended or overriden. As far as I can tell, creating functional plugins like As such, I think there should be a native syntax for colors like this: <a class="bg-mix-in/srgb bg-sky/10 bg-mix-white/30">asdf</a> background-color: color-mix(in srgb, var(--color-sky) 10%, var(--color-white) 30%); The default color space should match the <a class="bg-sky bg-mix-white">asdf</a> background-color: color-mix(in oklch, var(--color-sky), var(--color-white)); Would a PR for this be welcome? Related: #14712 |
Beta Was this translation helpful? Give feedback.
-
usecase: i would love to have an easy way with tailwind to add a semitransparent overlay to an element (which has a solid background color) on hover/press/etc interactions.
something like:
currently i am adding an
::after
pseudo-element, but since tailwind v4 has added support for csscolor-mix()
i was wondering if the team has any plans to add dedicated color-mix utilities, which would make usecases like the above a bit easier?thanks!
Beta Was this translation helpful? Give feedback.
All reactions