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
POST https://luminagradientgenerator.usefulweb.app/api/v1/calculate– run Perceptual Gradient Generator (OKLCH, OKLab, CSS)GET https://luminagradientgenerator.usefulweb.app/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
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.
| Field | Type | Default | Description |
|---|---|---|---|
stops | textarea | "#164E63\n#EBC17E" | Color stops (one per line: color and optional position in %) |
space | select (oklch, oklab, lab, lch, srgb-linear, srgb) | "oklch" | Interpolation space |
hue | select (shorter, longer, increasing, decreasing) | "shorter" | Hue path (OKLCH and LCH) |
kind | select (linear, radial, conic) | "linear" | Gradient shape |
angle | number | 90 | Angle (degrees; linear direction or conic start) |
steps | integer | 9 | Palette steps and fallback stops |
mesh | textarea | — | 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)
- Streamable HTTP endpoint:
https://luminagradientgenerator.usefulweb.app/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
lumina_gradient_generator - Local stdio connector:
node src/mcp-stdio.ts --tool=lumina-gradient-generator
{
"mcpServers": {
"lumina-gradient-generator": { "type": "http", "url": "https://luminagradientgenerator.usefulweb.app/mcp" }
}
}