This function calculates a linear gradient string given a node & fill from the Figma API (not plugin API)
'component' is a node from the Figma API
component.fills.map((fill: any) => {
if(fill.type == "GRADIENT_LINEAR" && fill.visible != false) {
let gradientStr = createLinearGradient(fill, component)
}
})
If not working, feel free to email me ([email protected]) for more assistance :)
P.S. This code snippet was copied from Unify. Unify converts your Figma components into production-ready code. Check it out here: https://www.useunify.app/