fill_gradient
Apply linear or radial gradients to regions, by default only shading existing pixels. Use dithering for retro palettes.
Instructions
Fill a region with a gradient, by default only where pixels already exist.
Args:
colors: 2+ colour stops, e.g. ["#000000", "#ff004d", "#ffec27"], spread
evenly. For dither=True, provide exactly 2 colours.
gradient_type: "linear" or "radial".
angle: Direction in degrees for linear gradients (0 = left->right).
dither: Ordered (Bayer 4x4) dithering between 2 colours instead of smooth
interpolation, great for limited palettes / retro looks.
x, y, width, height: Region (defaults to the whole canvas).
respect_alpha: Leave transparent pixels transparent (default). The gradient
then shades the artwork inside the region rather than filling the region.
Pass False to paint the whole rectangle, background included.
Returns `pixels_written` and `pixels_skipped` so the caller can tell how much of
the region was actually covered.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Default: 0. | |
| y | No | Default: 0. | |
| angle | No | Default: 0.0. | |
| frame | No | Default: 1. | |
| layer | No | ||
| width | No | ||
| colors | Yes | ||
| dither | No | Default: false. | |
| height | No | ||
| filename | Yes | ||
| gradient_type | No | Default: "linear". | linear |
| respect_alpha | No | Default: true. |