yagudaev / css-gradient-to-figma

Plugin to insert a CSS Gradient into Figma
https://www.figma.com/community/plugin/1157089605295322526/CSS-Gradient-to-Figma
MIT License
18 stars 2 forks source link

Support stop positions #10

Closed gluck closed 1 year ago

gluck commented 1 year ago

Would be nice if the plugin were to support stop positions for colors. Percentage is fairly easy to add, px might be more complex.

yagudaev commented 1 year ago

Thanks for posting the issue Francois 😁.

The code for this is here: https://github.com/yagudaev/css-gradient-to-figma/blob/main/src/shared/color.ts#L61.

Found a few good examples in: https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient.

From what I can tell, as long as the parser (https://github.com/rafaelcaricio/gradient-parser) supports pulling in the stop position, it should be relatively straightforward.

I'll give it a try when I have a moment. You are also free to try; pull requests are always welcome 😁.