# Colour mixer

Mix two colours by any ratio in sRGB or OKLab, or lighten or darken a colour by a percentage.

- Endpoint: `POST https://setget.net/v1/tools/color-blend` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `color-blend`
- Page: https://setget.net/tools/color-blend

## Inputs

- `color` (required, string): The starting colour, in any CSS format.
- `other` (optional, string): The colour to mix in. Needed for mode "mix".
- `mode` (optional, string, one of `mix`, `lighten`, `darken`, default `"mix"`): mix blends towards "other", lighten towards white, darken towards black.
- `amount` (optional, number, default `50`, range 0..100): How far to go, in percent. 0 keeps the starting colour, 100 gives the other one.
- `space` (optional, string, one of `srgb`, `oklab`, default `"srgb"`): Colour space to mix in. OKLab gives more even, natural steps.

## Example 1

```json
{"input":{"color":"#ff0000","other":"#0000ff"}}
```

Result:

```json
{"hex":"#800080","rgb":"rgb(128, 0, 128)","hsl":"hsl(300, 100%, 25%)","alpha":1,"mode":"mix","amount":50,"space":"srgb"}
```

## Example 2: The same mix in OKLab

```json
{"input":{"color":"#ff0000","other":"#0000ff","space":"oklab"}}
```

Result:

```json
{"hex":"#8c53a2","rgb":"rgb(140, 83, 162)","hsl":"hsl(283.4, 32.3%, 48.1%)","alpha":1,"mode":"mix","amount":50,"space":"oklab"}
```

## Example 3: Lighten by 20%

```json
{"input":{"color":"#0088cc","mode":"lighten","amount":20}}
```

Result:

```json
{"hex":"#33a0d6","rgb":"rgb(51, 160, 214)","hsl":"hsl(200, 66.7%, 52%)","alpha":1,"mode":"lighten","amount":20,"space":"srgb"}
```

**Which colour formats can I type?** Hex (#rgb, #rrggbb, #rrggbbaa), rgb() and rgba(), hsl() and hsla(), hwb(), oklab(), oklch(), and any of the 148 CSS colour names such as "rebeccapurple".

**Why do sRGB and OKLab give different mixes?** sRGB averages the raw red, green and blue numbers, which can look dark or muddy in the middle. OKLab is built around how people see colour, so the steps look more even. CSS color-mix() uses OKLab by default.

**What do lighten and darken do exactly?** They mix the colour with white or black by the given percentage, which designers call a tint or a shade.
