Guide

THE TOOLBOX / DESIGN SYSTEMS & COLOR

Convert HEX, RGB, HSL, OKLCH
and build 50–950 palettes.

Inspect perceptual OKLCH coordinates, preview 11-stop shade scales with WCAG contrast ratios against white and black, and copy CSS or Tailwind v4 tokens.

Enter a HEX, RGB, or HSL color to convert to OKLCH and build a 50–950 scale.

Presets
1. Base Color & Space Conversions
HEX
#2563eb
RGB
rgb(37, 99, 235)
HSL
hsl(221, 83%, 53%)
OKLCH
oklch(0.546 0.215 262.9)
Live UI Token PreviewPrimary Button (600)Soft Badge (50 / 800)
2. 50–950 Scale & Theme Tokens

THE DETAILS

W3C CSS Color Module Level 4, Oklab/OKLCH math, and Tailwind shade scales.

1. Step-by-Step Workflow

Pick or type a base color in HEX, RGB, or HSL (or click the Cobalt, Emerald, Violet, or Amber preset) and enter a token name such as brand or primary. Click any conversion card or 50–950 swatch to copy its value, or copy the full Tailwind v4, Tailwind v3, or CSS Variables block.

2. W3C CSS Color 4 & Oklab Matrix Math

To compute oklch(L C H), sRGB channels are gamma-linearized, transformed into LMS cone responses, cube-rooted for perceptual uniformity, and projected into Björn Ottosson’s Oklab polar coordinates: Lightness (0..1), Chroma (0..0.4), and Hue angle (0..360°).

3. 11-Stop Shade Architecture (50–950)

Design systems require balanced tint and shade steps: 50–200 for subtle backgrounds and badges, 300–400 for borders and dark-mode accents, 500–600 for primary buttons, and 700–950 for high-contrast text and dark surfaces.

CSS Color Space Comparison Matrix

Color SpaceCSS Syntax ExamplePerceptually UniformBest Use Case
HEX (sRGB)#2563ebNoCompact static tokens, Figma handoffs, SVG attributes
RGB (sRGB)rgb(37, 99, 235)NoCanvas pixel manipulation & alpha channel composition
HSL (Cylindrical sRGB)hsl(221, 83%, 53%)No (hue-skewed lightness)Quick single-hue tint/shade adjustments
OKLCH (CSS Color 4)oklch(0.546 0.215 262.9)Yes (Oklab space)Tailwind v4 themes & accessible design systems

Common Palette & Theme Design Pitfalls

Assuming 500 Stops Always Pass White Text Contrast

While a 500 or 600 blue or violet passes 4.5:1 with white text, yellow, amber, and lime 500 stops have high luminance and require dark (900/950) foreground text. Check the W and B scores on every swatch.

Over-Saturated 50 & 100 Background Tints

Keeping full chroma on very light 50-level background surfaces can look neon. Slightly tapering saturation on the lightest stop produces cleaner UI card backgrounds.

Hardcoding HEX Instead of Semantic CSS Variables

Exporting your scale as --color-brand-500 custom properties lets light and dark themes remap semantic surface and accent tokens without duplicating component classes.

Achromatic Grays Have Zero Chroma in OKLCH

Pure grays (#000000–#ffffff) have C = 0 in OKLCH, where the hue angle is undefined and normalized to 0.

Frequently Asked Questions

Why is OKLCH preferred over HSL for modern design systems and Tailwind v4?

In traditional HSL, yellow (hue 60°) and blue (hue 240°) at 50% lightness have vastly different perceived brightness to the human eye. OKLCH (Oklab Lightness, Chroma, Hue) models human visual perception so every 500-level shade across different hues shares consistent perceptual lightness and predictable WCAG contrast.

How do I read the W and B contrast scores on each 50–950 shade swatch?

Each swatch displays its WCAG 2.1 contrast ratio against pure white (W) and pure black (B). Any stop with W >= 4.5 is safe for white foreground text, and any stop with B >= 4.5 is safe for dark foreground text.

What is the difference between Tailwind v4 @theme and Tailwind v3 config exports?

Tailwind CSS v4 configures design tokens directly in CSS using an @theme { --color-brand-500: oklch(...); } block, whereas Tailwind v3 uses a JavaScript module.exports.theme.extend.colors object inside tailwind.config.js. Both formats plus standard :root CSS variables are generated automatically.

Which color input formats are accepted?

You can enter 3-digit or 6-digit HEX (#2563eb), CSS RGB (rgb(37, 99, 235)), or CSS HSL (hsl(221, 83%, 53%)), or use the native color picker.

Does this color converter and palette generator run 100% locally?

Yes. All sRGB-to-linear-Oklab matrix transformations, shade interpolations, and WCAG luminance calculations run in your browser with zero network calls.