Catalog/design-color-mix

Design

Mix two colors API

Mixes two colors at a given ratio using additive (linear-light), subtractive (CMY pigment), or perceptual (OKLab) models — each gives a physically distinct result. Answers 'What do you get mixing these two colors?', 'Blend two paints (subtractive) at 50/50.'

Price$0.04per request
MethodPOST
Route/v1/design/color-mix
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
colormixblendadditivesubtractiveoklabpigmentinterpolatedesign
API URLhttps://x402.hexl.dev/v1/design/color-mix
Integration docs
Example request
{
  "color1": "#0000ff",
  "color2": "#ffff00",
  "ratio": 0.5,
  "model": "subtractive"
}
Example response
{
  "color1": "#0000ff",
  "color2": "#ffff00",
  "ratio": 0.5,
  "model": "subtractive",
  "hex": "#808080",
  "rgb": {
    "r": 128,
    "g": 128,
    "b": 128
  },
  "hsl": {
    "h": 0,
    "s": 0,
    "l": 50.2
  },
  "interpretation": "50% #0000ff + 50% #ffff00 (subtractive) = #808080."
}
Input schema
{
  "type": "object",
  "required": [
    "color1",
    "color2"
  ],
  "properties": {
    "color1": {
      "type": "string",
      "examples": [
        "#0000ff"
      ]
    },
    "color2": {
      "type": "string",
      "examples": [
        "#ffff00"
      ]
    },
    "ratio": {
      "type": "number",
      "description": "weight toward color2 (0-1)",
      "examples": [
        0.5
      ]
    },
    "model": {
      "type": "string",
      "enum": [
        "additive",
        "subtractive",
        "perceptual"
      ],
      "examples": [
        "subtractive"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}