figx icon indicating copy to clipboard operation
figx copied to clipboard

🚀Feature request: add function "toGradientPaint" and "isGradientPaint"

Open randomgoose opened this issue 3 years ago • 0 comments

Describe the solution you'd like

toGradientPaint should take a valid css gradient string and return a Figma GradientPaint object.

For example:

Input: linear-gradient(90deg, #fff, #000)

Output:

{
    type: 'GRADIENT_LINEAR',
    gradientStops: [
        { position: 0, color: { r: 1, g: 1, b: 1 } },
        { position: 1, color: { r: 0, g: 0, b: 0 } }
    ],
    gradientTransform: [ [0, 1, 0], [-1, 0, 0] ]
}

And isGradientPaint should check if the input is a valid Figma GradientPaint object.

randomgoose avatar Jul 16 '22 00:07 randomgoose