Catalog/design-gradient

Design

Gradient interpolation API

Interpolates an N-stop gradient between two colors in sRGB, OKLCH (shortest-hue arc), OKLab, or CIE-LAB, returning the stops plus a ready CSS linear-gradient string. OKLCH avoids the muddy mid-tones of naive sRGB blends. Answers 'Generate gradient stops between two colors.', 'Interpolate this gradient in OKLCH.'

Price$0.04per request
MethodPOST
Route/v1/design/gradient
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
colorgradientinterpolationoklchsrgblabblendstopsdesign
API URLhttps://x402.hexl.dev/v1/design/gradient
Integration docs
Example request
{
  "from": "#ff0000",
  "to": "#0000ff",
  "steps": 5,
  "space": "oklch"
}
Example response
{
  "from": "#ff0000",
  "to": "#0000ff",
  "space": "oklch",
  "steps": 5,
  "colors": [
    "#ff0000",
    "#e8007b",
    "#ba00c2",
    "#7a00f4",
    "#0000ff"
  ],
  "cssGradient": "linear-gradient(to right, #ff0000, #e8007b, #ba00c2, #7a00f4, #0000ff)"
}
Input schema
{
  "type": "object",
  "required": [
    "from",
    "to"
  ],
  "properties": {
    "from": {
      "type": "string",
      "examples": [
        "#ff0000"
      ]
    },
    "to": {
      "type": "string",
      "examples": [
        "#0000ff"
      ]
    },
    "steps": {
      "type": "number",
      "examples": [
        5
      ]
    },
    "space": {
      "type": "string",
      "enum": [
        "srgb",
        "oklch",
        "oklab",
        "lab"
      ],
      "examples": [
        "oklch"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}