# Gradient image generator

Make an SVG image filled with a linear or radial gradient from your colour stops, plus the matching CSS.

- Endpoint: `POST https://setget.net/v1/tools/gradient-image` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `gradient-image`
- Page: https://setget.net/tools/gradient-image

## Inputs

- `colours` (required, array): Two to twelve colours in order. Add a position to place a stop, such as "#ff0080 30%".
- `type` (optional, string, one of `linear`, `radial`, default `"linear"`): Gradient shape.
- `angle` (optional, number, default `90`, range -360..360): Direction of a linear gradient in degrees, as in CSS: 0 runs bottom to top, 90 left to right.
- `width` (optional, integer, default `800`, range 1..4000): Width in pixels.
- `height` (optional, integer, default `400`, range 1..4000): Height in pixels.

## Example 1

```json
{"input":{"colours":["#2a78d6","#e87ba4"],"width":200,"height":100}}
```

Result:

```json
{"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"100\" viewBox=\"0 0 200 100\"><defs><linearGradient id=\"sgfac28adc\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"50\" x2=\"200\" y2=\"50\"><stop offset=\"0%\" stop-color=\"#2a78d6\"/><stop offset=\"100%\" stop-color=\"#e87ba4\"/></linearGradient></defs><rect width=\"200\" height=\"100\" fill=\"url(#sgfac28adc)\"/></svg>","width":200,"height":100,"css":"linear-gradient(90deg, #2a78d6 0%, #e87ba4 100%)"}
```

## Example 2: A radial gradient with a placed stop

```json
{"input":{"colours":["#fde68a","#f97316 40%","#7c2d12"],"type":"radial"}}
```

**How does the angle work?** As in CSS: 0 points up, 90 points right, 180 points down. The "css" value in the result gives the same gradient for a stylesheet.
