Replies: 1 comment 4 replies
-
|
This is a great utility! Eased gradients make such a noticeable difference for overlays. A few suggestions to extend this: 1. Add other easing curves @utility via-ease-out-sine { /* reverse the color-mix percentages */ }
@utility via-ease-in-out-sine { /* combine both */ }
@utility via-ease-in-cubic { /* steeper curve */ }2. Make it configurable via CSS variable @utility via-eased {
--tw-gradient-easing: var(--gradient-easing, ease-in-sine);
/* dynamically select stops based on --tw-gradient-easing */
}3. Consider using CSS background: linear-gradient(in oklab ease-in, red, blue);For now, your As for core inclusion - this would be a nice addition to Tailwind's gradient utilities. The discovery aspect you mentioned is valuable. Maybe worth opening a feature request? |
Beta Was this translation helpful? Give feedback.
4 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.
Uh oh!
There was an error while loading. Please reload this page.
-
I often have the need to overlay images/videos with a subtle gradient to make overlaying UI elements better visible. To prevent ugly "sharp edges" in these gradients, a friend showed me the concept of eased gradients.
In tailwind@4, I was able to solve this in a pretty elegant way using a custom utility:
👉 View the Demo
The utility
Usage
Tailwind Play Example:
https://play.tailwindcss.com/WlgiByU0ci?file=css
Maybe core?
As tailwindcss is not only an amazing authoring tool but also helps me hugely with discovery of new concepts, it could have helped me if something like this would be part of tailwindcss' core and thus intellisense would suggest it.
Beta Was this translation helpful? Give feedback.
All reactions