Skip to content

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

@randomgoose

Description

@randomgoose

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions