Catalog/util-color

Utilities

Color convert & contrast API

Convert a color between hex/rgb/hsl, or compute the WCAG contrast ratio between two colors (with AA/AAA accessibility pass/fail). Answers 'hex to rgb', 'convert this color to hsl', 'contrast ratio between these colors', 'is this color combo accessible'.

Price$0.01per request
MethodPOST
Route/v1/util/color
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
utilcolorhexrgbhslcontrastwcagaccessibility
API URLhttps://x402.hexl.dev/v1/util/color
Integration docs
Example request
{
  "op": "convert",
  "color": "#3498db"
}
Example response
{
  "hex": "#3498db",
  "rgb": "rgb(52, 152, 219)",
  "hsl": "hsl(204, 70%, 53%)",
  "values": {
    "r": 52,
    "g": 152,
    "b": 219,
    "h": 204,
    "s": 70,
    "l": 53
  }
}
Input schema
{
  "type": "object",
  "required": [
    "op"
  ],
  "properties": {
    "op": {
      "type": "string",
      "enum": [
        "convert",
        "contrast"
      ]
    },
    "color": {
      "type": "string",
      "examples": [
        "#3498db"
      ]
    },
    "color2": {
      "type": "string"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}