Stop Guessing Colors.
Start Shipping Accessible Themes.

Pick one color. Get a complete light and dark theme with every contrast ratio checked against WCAG standards. Ready-to-use CSS variables in seconds.

Launch the Generator

How It Works

Three steps. No design degree required.

1

Pick a Color

Use the color picker or type any hex code. This becomes your brand's primary color -- the foundation of both themes.

2

Themes Are Generated

The engine converts your color to HSL, then derives 15 design tokens for light and dark modes: backgrounds, surfaces, text hierarchy, borders, and semantic colors.

3

Contrast Is Enforced

Every text/background pair is checked against WCAG 2.1. Colors that fail are automatically adjusted along their lightness axis until they pass AA or AAA.

What You Get

Everything you need to go from a single hex code to a production-ready color system.

Aa

WCAG Contrast Audit

Every foreground/background pair is tested against AA (4.5:1), AA Large (3:1), and AAA (7:1). You see the exact ratio and pass/fail status for each.

</>

Copy-Paste CSS Variables

Get a complete CSS block with custom properties that support both prefers-color-scheme media queries and data-theme attribute toggling.

15

15 Design Tokens

Background, surface, surface-alt, primary, primary-hover, primary-text, text, text-secondary, text-muted, border, border-light, success, warning, error, and info.

A+

Auto-Correction

When a derived color fails contrast requirements, the generator incrementally adjusts its lightness until it passes -- preserving the hue and saturation you chose.

WCAG Contrast Levels Explained

The Web Content Accessibility Guidelines define minimum contrast ratios to ensure text is readable by people with low vision.

AA Large
3 : 1

Minimum for large text (18px bold / 24px regular). Acceptable for UI components and graphical elements.

AA
4.5 : 1

Minimum for normal-sized body text. The standard most organizations target. This is what the generator enforces by default.

AAA
7 : 1

Enhanced contrast for maximum readability. Recommended for long-form content and critical UI text.

Token Reference

Here's what each generated token is designed for.

background Page-level background. White in light mode, near-black in dark mode. surface Cards, modals, dropdowns -- anything that sits above the background. surfaceAlt Alternate surface for visual separation (table rows, sidebars). primary Your brand color, adjusted for contrast. Buttons, links, active states. primaryHover Slightly darker (light) or lighter (dark) variant for hover/focus states. primaryText Text color that sits on top of the primary color (e.g., button labels). text Primary body text. Meets AAA (7:1) against the background. textSecondary Descriptions, subtitles. Meets AA (4.5:1). textMuted Timestamps, captions, placeholders. Meets AA Large (3:1). border Default border for inputs, dividers, and outlines. borderLight Subtle border for cards and low-emphasis separators. success Positive states: confirmations, completed actions, valid inputs. warning Caution states: alerts, approaching limits, non-blocking issues. error Destructive/error states: validation errors, failed actions. info Informational: tips, links, neutral highlights.

How the Contrast Audit Works

The audit uses the exact same math defined in the WCAG 2.1 specification. Here's what happens under the hood.

1

sRGB to Linear

Each color channel (R, G, B) is converted from the sRGB color space to linear light values using the formula from WCAG 2.1 - Relative Luminance:

if sRGB <= 0.03928: linear = sRGB / 12.92
else: linear = ((sRGB + 0.055) / 1.055) ^ 2.4
2

Relative Luminance

The linearized channels are weighted by how the human eye perceives brightness, per the IEC 61966-2-1 standard:

L = 0.2126 * R + 0.7152 * G + 0.0722 * B
3

Contrast Ratio

The luminance of the lighter and darker colors are compared using the formula from WCAG 2.1 - Contrast Ratio:

ratio = (L_lighter + 0.05) / (L_darker + 0.05)

This produces a value between 1:1 (identical) and 21:1 (black on white).

4

Pass/Fail Evaluation

The ratio is tested against the three WCAG 2.1 Success Criteria thresholds defined in SC 1.4.3 and SC 1.4.6:

  • AA Large (3:1) -- text 18px bold or 24px+ regular, and UI components
  • AA (4.5:1) -- normal body text at any size
  • AAA (7:1) -- enhanced contrast for maximum readability
5

Auto-Correction

If a text/background pair fails its target ratio, the generator walks the foreground color's lightness in 2% increments (darkening for light themes, lightening for dark themes) until the ratio passes. The hue and saturation stay locked -- only lightness changes.

Sources & Credits

This tool stands on the shoulders of established standards and resources.

Primary Inspiration

color-hex.com

The original inspiration for this tool. Color-Hex provides comprehensive color information, hex-to-RGB/HSL/CMYK conversions, color palettes, and a web-safe color directory. This project builds on that foundation by adding automated theme generation and accessibility compliance.

WCAG 2.1

Web Content Accessibility Guidelines from the W3C. The contrast ratio formula, relative luminance definition, and AA/AAA thresholds all come directly from this specification.

SC 1.4.3 -- Contrast (Minimum)

Defines the 4.5:1 ratio for normal text and 3:1 for large text. This is the AA level that the generator enforces by default for all text tokens.

SC 1.4.6 -- Contrast (Enhanced)

Defines the 7:1 ratio (AAA). The generator reports AAA compliance in the audit table and enforces it for primary body text.

Relative Luminance (WCAG)

The sRGB linearization and luminance weighting coefficients (0.2126, 0.7152, 0.0722) used in the contrast calculation come from this definition, based on IEC 61966-2-1.

Material Design -- Dark Theme

The dark theme approach (elevated surfaces via tinted overlays, #121212 base) follows the patterns established by Google's Material Design guidelines.

Ready to build your theme?

Pick a color and get accessible light and dark themes in seconds.

Open the Generator