Gradient image generator

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

Input

Two to twelve colours in order. Add a position to place a stop, such as "#ff0080 30%".
Gradient shape.
Direction of a linear gradient in degrees, as in CSS: 0 runs bottom to top, 90 left to right.
Width in pixels.
Height in pixels.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/gradient-image \
  -H 'Content-Type: application/json' \
  -d '{"input":{"colours":["#2a78d6","#e87ba4"],"width":200,"height":100}}'
import json, urllib.request

body = {'input': {'colours': ['#2a78d6', '#e87ba4'], 'width': 200, 'height': 100}}
request = urllib.request.Request("https://setget.net/v1/tools/gradient-image", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/gradient-image", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"colours":["#2a78d6","#e87ba4"],"width":200,"height":100}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "gradient-image",
  "input": {
    "colours": [
      "#2a78d6",
      "#e87ba4"
    ],
    "width": 200,
    "height": 100
  }
}
{
  "input": {
    "colours": [
      "#2a78d6",
      "#e87ba4"
    ],
    "width": 200,
    "height": 100
  }
}

Endpoint: POST /v1/tools/gradient-image. Over MCP: run_tool with slug: "gradient-image". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
colours array yes Two to twelve colours in order. Add a position to place a stop, such as "#ff0080 30%".
type string no Gradient shape. One of: linear, radial. Default: "linear".
angle number no Direction of a linear gradient in degrees, as in CSS: 0 runs bottom to top, 90 left to right. Default: 90. From -360 to 360.
width integer no Width in pixels. Default: 800. From 1 to 4000.
height integer no Height in pixels. Default: 400. From 1 to 4000.

Examples

Input
{
  "colours": [
    "#2a78d6",
    "#e87ba4"
  ],
  "width": 200,
  "height": 100
}
Result
{
  "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%)"
}

A radial gradient with a placed stop

Input
{
  "colours": [
    "#fde68a",
    "#f97316 40%",
    "#7c2d12"
  ],
  "type": "radial"
}
Result

Different every time. Press the example button above to see one.

Questions

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.