API & MCP

Everything a person can do on Perceptual Gradient Generator (OKLCH, OKLab, CSS), a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Perceptual Gradient Generator (OKLCH, OKLab, CSS)

Enter 2–16 color stops in any CSS color syntax. Get a modern CSS gradient that interpolates in OKLab, OKLCH, Lab, LCH or linear light, a fallback with dense HEX stops and its measured error, evenly spaced palette steps and an optional bilinear mesh gradient as PNG.

Inputs of Perceptual Gradient Generator (OKLCH, OKLab, CSS)
FieldTypeDefaultDescription
stopstextarea"#164E63\n#EBC17E"Color stops (one per line: color and optional position in %)
spaceselect (oklch, oklab, lab, lch, srgb-linear, srgb)"oklch"Interpolation space
hueselect (shorter, longer, increasing, decreasing)"shorter"Hue path (OKLCH and LCH)
kindselect (linear, radial, conic)"linear"Gradient shape
anglenumber90Angle (degrees; linear direction or conic start)
stepsinteger9Palette steps and fallback stops
meshtextarea—Mesh gradient grid (optional; one row of colors per line, 2–6 per side)

Example request

Teal to sand in OKLCH

curl -X POST https://luminagradientgenerator.usefulweb.app/api/v1/calculate -H 'content-type: application/json' -d '{"stops":"#164E63\n#EBC17E","space":"oklch","hue":"shorter","kind":"linear","angle":90,"steps":9,"mesh":""}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "lumina-gradient-generator": { "type": "http", "url": "https://luminagradientgenerator.usefulweb.app/mcp" }
  }
}