← Home

color

Deterministic color math and accessibility checks for AI agents.

An LLM asked to convert a hex color to HSL will produce plausible-looking numbers that are subtly wrong. Contrast ratios, WCAG compliance, color mixing, and perceptual color space conversions all require exact floating-point math. Euclid's color tool uses culori for precise conversions across 8 color spaces, real WCAG 2.1 contrast checks, and perceptual color manipulation.


Live

euclid / color
color({ operation: "convert", color: "#FF6B35", to_space: "hsl" }){ "h": 16.04, "s": 100, "l": 60.4 }
color({ operation: "wcag_level", foreground: "#FFFFFF", background: "#2563EB", size: "normal" }){ "ratio": "5.17:1", "meets_aa": true, "meets_aaa": false }
color({ operation: "contrast_ratio", foreground: "#333333", background: "#F5F5F5" }){ "ratio": "11.59:1" }
color({ operation: "lighten", color: "#2563EB", amount: 15 }){ "hex": "#6b95f1" }

Operations

convertparsecontrast ratiowcag levelrelative luminancelighten / darkensaturate / desaturatemixcomplementanalogoustriadictetradic

Examples

What it looks like in practice

Converting a brand color to HSL for a design system

color({ operation: "convert", color: "#FF6B35", to_space: "hsl" })

{ "h": 16.04, "s": 100, "l": 60.4 }

Checking if white text on a blue button meets WCAG AA

color({ operation: "wcag_level", foreground: "#FFFFFF", background: "#2563EB", size: "normal" })

{ "ratio": "5.17:1", "meets_aa": true, "meets_aaa": false }

Computing contrast ratio for an accessibility audit

color({ operation: "contrast_ratio", foreground: "#333333", background: "#F5F5F5" })

{ "ratio": "11.59:1" }

Lightening a color for a hover state

color({ operation: "lighten", color: "#2563EB", amount: 15 })

{ "hex": "#6b95f1" }

Mixing two colors for a gradient midpoint

color({ operation: "mix", color: "#FF0000", color2: "#0000FF", weight: 0.5 })

{ "hex": "#8c53a2" }

Generating a complementary color for a palette

color({ operation: "complement", color: "#FF6B35" })

{ "hex": "#35c9ff" }


Who uses this

Built for agents across every domain

fn()

Design system engineer

An agent converting brand colors between hex, HSL, and oklch for a token file — where a rounding error means the wrong shade ships to production.

fn()

Accessibility auditor

Running WCAG 2.1 contrast checks across an entire component library. A 4.49 ratio fails AA; a 4.50 passes. There is no room for approximation.

fn()

Frontend developer

Computing lighten/darken values for hover, active, and disabled states that must stay visually consistent across light and dark themes.

fn()

Brand designer

An AI tool generating complementary, analogous, and triadic palettes from a single brand color — each swatch must be mathematically precise.

fn()

Data visualisation engineer

Mixing colors for chart gradients where perceptual uniformity matters. oklch mixing produces better results than naive RGB interpolation.

fn()

Email developer

Converting oklch design tokens to hex for email clients that only support hex and rgb — every conversion must be exact or the brand colors drift.


Try color on Euclid Cloud

One MCP connection. Every computation your agents need.

Get started