Catalog/design-lab-convert

Design

RGB <-> CIE-LAB API

Converts between sRGB/hex and CIE-LAB (with XYZ and LCh intermediates) under the D65 white point, both directions, with in-gamut flag on the reverse path. Answers 'What is the CIE-LAB value of this color?', 'Convert LAB back to a hex color.'

Price$0.04per request
MethodPOST
Route/v1/design/lab-convert
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
colorlabcielabxyzd65perceptualconvertdesigncolorspace
API URLhttps://x402.hexl.dev/v1/design/lab-convert
Integration docs
Example request
{
  "color": "#ff6347"
}
Example response
{
  "direction": "rgb->lab",
  "input": "#ff6347",
  "hex": "#ff6347",
  "rgb": {
    "r": 255,
    "g": 99,
    "b": 71
  },
  "hsl": {
    "h": 9.13,
    "s": 100,
    "l": 63.92
  },
  "xyz": {
    "x": 46.844,
    "y": 30.645,
    "z": 9.408
  },
  "lab": {
    "L": 62.207,
    "a": 57.851,
    "b": 46.42
  },
  "lch": {
    "L": 62.207,
    "c": 74.173,
    "h": 38.744
  },
  "whitePoint": "D65/2°"
}
Input schema
{
  "type": "object",
  "properties": {
    "color": {
      "type": "string",
      "description": "hex, rgb(), hsl(), or CSS name",
      "examples": [
        "#ff6347",
        "tomato",
        "rgb(255,99,71)"
      ]
    },
    "lab": {
      "type": "object",
      "description": "reverse: { L, a, b }",
      "properties": {
        "L": {
          "type": "number"
        },
        "a": {
          "type": "number"
        },
        "b": {
          "type": "number"
        }
      }
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}