Catalog/design-oklab-convert

Design

RGB <-> OKLab API

Converts between sRGB/hex and Ottosson's OKLab perceptual color space (with OKLCh derived), both directions. OKLab gives perceptually-uniform lightness and is the modern basis for color UIs. Answers 'What is the OKLab value?', 'Convert OKLab back to hex.'

Price$0.04per request
MethodPOST
Route/v1/design/oklab-convert
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
coloroklabperceptualottossonuniformconvertcolorspacedesign
API URLhttps://x402.hexl.dev/v1/design/oklab-convert
Integration docs
Example request
{
  "color": "#ff6347"
}
Example response
{
  "direction": "rgb->oklab",
  "input": "#ff6347",
  "hex": "#ff6347",
  "rgb": {
    "r": 255,
    "g": 99,
    "b": 71
  },
  "hsl": {
    "h": 9.13,
    "s": 100,
    "l": 63.92
  },
  "oklab": {
    "L": 0.696,
    "a": 0.165,
    "b": 0.105
  },
  "oklch": {
    "L": 0.696,
    "c": 0.196,
    "h": 32.321
  }
}
Input schema
{
  "type": "object",
  "properties": {
    "color": {
      "type": "string",
      "examples": [
        "#ff6347"
      ]
    },
    "oklab": {
      "type": "object",
      "properties": {
        "L": {
          "type": "number"
        },
        "a": {
          "type": "number"
        },
        "b": {
          "type": "number"
        }
      }
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}