Skip to content

postcss-gradients-interpolation-method #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Mar 4, 2022

fixes : #85
fixes : #233

related to : #177


It uses calc to avoid having to calculate the positions of color stops.
This makes it possible to support calc and var values in positions.

just works : linear-gradient(in oklch 90deg, black 20% var(--perc-50),blue 70% 75%);

Technically allowed to have var in colors but the future color-mix plugin won't be able to handle those.

Color stops with only a color and Interpolation hints are not supported.


Note : this plugin in isolation is useless.
A separate plugin is required to downgrade color-mix().

This approach makes it possible to have all color-mix logic in a single plugin.

I think we can merge this as is just to get the ball rolling.

Comment on lines +109 to +116
func.nodes.splice(
// 1 before the current node
func.nodes.indexOf(node) - 1,
// remove none
0,
// insert these :
comma, color,
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This looks awesome and paves the way for color-mix

@Antonio-Laguna Antonio-Laguna merged commit 5f4273c into main Mar 4, 2022
@Antonio-Laguna Antonio-Laguna deleted the gradients-color-spaces--diligent-prawn-de683864e3 branch March 4, 2022 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add in color-space syntax to gradients Support for at keyword in css gradient functions
2 participants