x402AgentsToolsHub

Color Converter

Convert any color between hex, RGB and HSL with WCAG relative luminance — exact integer/channel math, no drift. Accepts #abc, #aabbcc, rgb() and hsl() input and reports every representation plus a light/dark verdict.

Worked examples

Emerald

GET /api/v1/media/color-convert?color=%2310b981

Result: #10b981 = rgb(16, 185, 129) = hsl(160, 84%, 39%)

CSS function form

GET /api/v1/media/color-convert?color=rgb(16%2C%20185%2C%20129)

Result: #10b981 = rgb(16, 185, 129) = hsl(160, 84%, 39%)

HSL in

GET /api/v1/media/color-convert?color=hsl(160%2C%2084%25%2C%2039%25)

Result: #10b77f = rgb(16, 183, 127) = hsl(160, 84%, 39%)

Machine API (x402)

$0.002 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/media/color-convert?color=%2310b981 HTTP/1.1
Host: agentstoolshub.com

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "media/color-convert",
  "input": {"color":"#10b981"},
  "result": { "value": 0.3639306191994719, "answer": "#10b981 = rgb(16, 185, 129) = hsl(160, 84%, 39%)" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Exact color-space conversion between hex, RGB and HSL using integer channels and the standard HSL formulation, plus WCAG relative luminance. Identical input always yields identical output — which is what design tokens and automated theming need.

Frequently asked questions

Which formats are accepted as input?

3- and 6-digit hex (with or without #), rgb()/rgba() (alpha ignored for conversion), and hsl()/hsla() with percentage saturation/lightness.

What is relative luminance used for?

It's the WCAG perceptual weight (green counts most, blue least) that powers contrast ratios — see the contrast-check tool for the accessibility verdict.

Related tools