You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tailwind offers a linear gradient feature. Start and end colours can be defined with .from-* and .to-* classes, and a third, intermediary colour can be added with .via-* classes.
Right now, adding a .via-* class for a three steps linear gradient adds the following CSS (here with the colour brand-primary):
As you can see, from and to are nested in a CSS custom property, while the via part is expanded in the middle of --tw-gradient-stops (please also note that --tw-gradient-via-position already exists). As a reminder, --tw-gradient-from and --tw-gradient-to variables look like the following:
It would be great if there was, similarly to --tw-gradient-from and --tw-gradient-to, a --tw-gradient-via variable, so that e.g. using the .via-brand-primary class would give this CSS:
More consistent with how from and to are implemented
I programmatically change the --tw-gradient-*-position properties to position a three steps CSS gradient, this would simplify my work as I wouldn’t have to manually set a via workaround:
I don’t think so. The via feature already exists and works by overriding --tw-gradient-stops and setting a transparent --tw-gradient-to.
This change would just nest one aspect of --tw-gradient-stops into two more CSS custom properties for more consistency and easier programmatic access, while the others gradient rules would keep access and priority over --tw-gradient-stops and the defaulted --tw-gradient-to.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Tailwind offers a linear gradient feature. Start and end colours can be defined with
.from-*and.to-*classes, and a third, intermediary colour can be added with.via-*classes.Right now, adding a
.via-*class for a three steps linear gradient adds the following CSS (here with the colourbrand-primary):As you can see,
fromandtoare nested in a CSS custom property, while theviapart is expanded in the middle of--tw-gradient-stops(please also note that--tw-gradient-via-positionalready exists). As a reminder,--tw-gradient-fromand--tw-gradient-tovariables look like the following:Request
It would be great if there was, similarly to
--tw-gradient-fromand--tw-gradient-to, a--tw-gradient-viavariable, so that e.g. using the.via-brand-primaryclass would give this CSS:Why this feature?
fromandtoare implemented--tw-gradient-*-positionproperties to position a three steps CSS gradient, this would simplify my work as I wouldn’t have to manually set aviaworkaround:Does this break any existing feature?
I don’t think so. The
viafeature already exists and works by overriding--tw-gradient-stopsand setting a transparent--tw-gradient-to.This change would just nest one aspect of
--tw-gradient-stopsinto two more CSS custom properties for more consistency and easier programmatic access, while the others gradient rules would keep access and priority over--tw-gradient-stopsand the defaulted--tw-gradient-to.Beta Was this translation helpful? Give feedback.
All reactions