Plugin API to convert gradient paint styles to CSS

Hello, I made a plugin called Color Import / Export.

Currently, it only handles Solid paint styles but I have received requests to add support for Gradient paint styles.

By looking at the GradientPaintStyle interface, there will be a lot of work and complexity in re-engineering how you convert these to CSS for the “Inspect” feature of Figma. A lot of that comes from converting the transform matrix into color stops and angles.

I am wondering if this API could be exposed to the plugin developers so we do not have to re-invent what is already done by Figma, but could use that functionality in new ways (such as for my plugin :slight_smile:).

Thank you.

2 Likes

I’m facing the same issue. I want to convert GradientPaintStyle values into variables so that they can be used in CSS. The Figma documentation doesn’t provide much information on how to handle color stops, angles, etc. It would be great if we could get more information from Figma on this. Has anyone already solved this problem?