Catalog/design-relative-luminance

Design

Relative luminance & brightness API

Computes WCAG relative luminance plus two perceived-brightness models (BT.601 luma and HSP) and a dark/light verdict for text-pairing. Answers 'What is the relative luminance of this color?', 'Is this color dark or light?'

Price$0.02per request
MethodPOST
Route/v1/design/relative-luminance
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
accessibilityluminancebrightnesswcagperceivedlumacolora11ydesign
API URLhttps://x402.hexl.dev/v1/design/relative-luminance
Integration docs
Example request
{
  "color": "#1d4ed8"
}
Example response
{
  "input": "#1d4ed8",
  "hex": "#1d4ed8",
  "rgb": {
    "r": 29,
    "g": 78,
    "b": 216
  },
  "hsl": {
    "h": 224.28,
    "s": 76.33,
    "l": 48.04
  },
  "relativeLuminance": 0.106679,
  "perceivedBrightnessLuma601": 0.3101,
  "perceivedBrightnessHSP": 0.3749,
  "isDark": true,
  "interpretation": "Dark color — pair with light text."
}
Input schema
{
  "type": "object",
  "required": [
    "color"
  ],
  "properties": {
    "color": {
      "type": "string",
      "examples": [
        "#1d4ed8"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}