---
title: "Color Contrast & Conversion API"
slug: color-contrast-conversion-api
url: https://apyhub.com/freedailypro/service/color-contrast-conversion-api
provider: FreeDailyPro
tags: [color-contrast, wcag, accessibility, color-converter, hex-to-rgb, design]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 2
atoms: 10
mcp: true
---

# Color Contrast & Conversion API

Easily check color contrast and convert colors using the Color Contrast & Conversion API. Get WCAG AA/AAA results and hex, RGB and HSL values.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/contrast` | What it does Checks whether two colors have enough contrast to be readable, using the WCAG accessib… | 10 |
| POST | `https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/color-convert` | What it does Converts a color between hex, RGB and HSL. Send either a hex code (such as #FF5733) or… | 10 |

## Endpoint reference

### WCAG Color Contrast Checker

`POST https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/contrast` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `background` | body | string | yes |  |
| `foreground` | body | string | yes |  |

#### Quickstart

Compare a foreground and background color for contrast by sending both hex values in the request body.

```bash
curl -X POST "https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/contrast" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"foreground":"#000000","background":"#ffffff"}'
```

#### What you'll get back

The live response to the request above:

```json
{
  "tool": "Contrast checker client and server side from freedailypro",
  "ratio": 21,
  "aa": true,
  "aaa": true,
  "aaLarge": true
}
```

### Hex, RGB & HSL Color Converter

`POST https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/color-convert` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `b` | body | number | no |  |
| `g` | body | number | no |  |
| `r` | body | number | no |  |
| `hex` | body | string | no |  |

#### Quickstart

Convert a color by sending the RGB or hex values in a JSON body.

```bash
curl -X POST "https://api.eu.apyhub.com/freedailypro/color-contrast-conversion-api/design/color-convert" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"hex":"#1e90ff"}'
```

#### What you'll get back

The live response to the request above:

```json
{
  "tool": "Color converter client and server side from freedailypro",
  "hex": "#1e90ff",
  "rgb": {
    "r": 30,
    "g": 144,
    "b": 255
  },
  "hsl": {
    "h": 210,
    "s": 100,
    "l": 55.9
  }
}
```

## About

## What it does
Color Contrast Checker compares a foreground and background color and returns the contrast ratio plus WCAG pass flags. Send two color values in the request body as `foreground` and `background`, and use the response to verify accessibility before you ship a UI.

The `/design/contrast` endpoint returns `ratio` from 1 to 21, along with `aa`, `aaLarge`, and `aaa` booleans. If the input is invalid, you get an `error` message instead of a contrast result. That makes it straightforward to plug into design systems, component libraries, or automated checks for button labels, charts, and other text-on-color combinations.

Color Contrast Checker also includes `/design/color-convert` for translating colors between `hex`, `rgb`, and `hsl`. Provide a `hex` string or RGB channel values in the request body, and get back normalized `hex`, `rgb`, and `hsl` values. Use it when you need to accept one format from a design tool and store or display another in your app.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/freedailypro/service/color-contrast-conversion-api
