set_gradient
Apply linear, radial, angular, or diamond gradients to Figma fills or strokes by node IDs, using color stops, angle or transform, and replace or append modes.
Instructions
Apply a gradient paint to fills or strokes. Give either angle in degrees (0 = left→right, 90 = top→bottom, 180 = right→left, 45 = top-left corner → bottom-right corner; measured in the node's box so corners always hit 0%/100% for LINEAR; default 90 for LINEAR, 0 otherwise) or a raw 2x3 transform (Figma gradientTransform). RADIAL/DIAMOND/ANGULAR are centered and fill the box. mode replace (default) replaces all paints; append adds on top. Returns per-node results ({id, ok, ...} or {id, error}); one failing node does not abort the batch.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"nodeIds": "<nodeIds>",
"stops": "<stops>"
},
"name": "set_gradient"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Target file (fileKey, id or name). Defaults to the most recently active file. | |
| mode | No | ||
| type | No | Default LINEAR | |
| angle | No | ||
| stops | Yes | Color stops, position 0..1 | |
| target | No | Default fill | |
| nodeIds | Yes | Figma node ids, e.g. ['12:34'] | |
| opacity | No | Paint opacity | |
| transform | No | Raw gradientTransform [[a,b,tx],[c,d,ty]] (overrides angle) |