Add Gradient
photopea_add_gradientReplace a layer's pixel content with a linear gradient. Define evenly spaced hex color stops and set an angle for the gradient direction (0° left-to-right).
Instructions
Apply a linear gradient fill to a layer, replacing its current pixel content. The target layer must already exist — use add_layer to create one first. Colors are distributed evenly across the gradient.
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": {
"target": "<target>",
"type": "<type>",
"colors": "<colors>"
},
"name": "photopea_add_gradient"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Gradient type (currently only 'linear' is supported) | |
| angle | No | Gradient angle in degrees (0 = left-to-right, 90 = top-to-bottom, default 0) | |
| colors | Yes | Array of hex color stops distributed evenly along the gradient (minimum 2, e.g. ['#ff0000', '#0000ff']) | |
| target | Yes | Layer name (string) or index (number) |