QuickUse Generator

Color Picker & Converter

Pick a color visually or convert between HEX, RGB, HSL, OKLCH and the Tailwind palette. Real-time sync, eyedropper where supported, 100% client-side.

Exact palette match.

#ffffff

Editorial guide

About this generator

An honest technical read on what is happening behind the Generate button.

Colors on screens are just numbers, but the formats vary wildly — HEX for designers, RGB for traditional CSS, HSL for intuitive manipulation, OKLCH for perceptually uniform spaces, and Tailwind classes for utility-first workflows. This picker holds all five in lockstep: edit any field, the other four resolve in microseconds and the swatch updates in place. Everything runs in your browser; nothing is sent to a server.

Color spaces: why one color has five names

A color on screen is, at the lowest level, three voltages — how hard the monitor drives its red, green, and blue subpixels. The reference standard for those voltages is sRGB (IEC 61966-2-1), ratified in 1996 and still the safe baseline for cross-device web work. Every HEX and every plain rgb() value in CSS lives in sRGB. Modern Apple displays — iPhone, iPad Pro, MacBook Pro — render the wider Display P3 gamut, which contains roughly 25% more color volume and reaches deeper reds and greens that sRGB cannot represent.

HSL, OKLCH, and the Tailwind palette are not separate color spaces in the gamut sense — they are different parameterisations of the same sRGB cube. HEX/RGB describe the cube in raw coordinates. HSL rotates it into hue/saturation/lightness for intuitive editing. OKLCH reshapes it to match human perception. The Tailwind class names are a curated 244-point subset designed for product UI.

HEX and RGB: the literal voltages

HEX is the designer's shorthand for an sRGB triple. #ef4444 means red 0xef (239), green 0x44 (68), blue 0x44 (68); the same color in CSS as rgb(239, 68, 68). The three-digit form #f44 expands by doubling each nibble: #f44#ff4444. The picker accepts both forms, normalises to lowercase six-digit hex on commit, and rejects malformed input inline rather than silently picking a fallback.

RGB is HEX with the parsing stripped away. Designers tend to copy HEX from Figma, engineers tend to type RGB directly into CSS-in-JS literals. There is no information difference. The eight-digit HEX form with alpha (#ef4444cc) is recognised by browsers but this picker handles three-channel sRGB only — alpha is a separate concern, layered on top.

HSL: intuitive but uneven

HSL was added to CSS in the late 2000s to give designers a more intuitive parameterisation: hue is the position on a 360° colour wheel, saturation is how vivid the color is, lightness is roughly how bright. Rotating the hue while holding saturation and lightness constant gives you a clean color cycle. Reducing saturation toward zero produces grey. Pushing lightness toward 100% produces white. These mappings match how people talk about color.

The catch is that HSL is geometric, not perceptual. Lightness 50% is darker for blue than for yellow — the same number maps to different perceived brightnesses depending on hue. For quick edits this is fine; for systematic work (palettes, dark-mode pairs, contrast tuning) it bites. That is the problem OKLCH solves.

OKLCH: perception as the unit

OKLab was published by Björn Ottosson in December 2020 as a blog post — not a formal paper, just a thoroughly worked-out solution to a problem in image processing. He fitted a transformation against empirical color-discrimination data (MacAdam ellipses, Luo-Rigg dataset) so that equal numerical distances in the space correspond to equal perceived distances for a human observer. The polar form, OKLCH, swaps the Cartesian a/b coordinates for chroma and hue. It was added to CSS Color Module Level 4 in late 2021.

The practical wins: interpolating between two OKLCH colors holds the perceived hue (HSL famously sags toward grey through the midpoint of complementary pairs), and adjusting lightness moves predictably across the entire spectrum. Tailwind v4 stores its entire palette in OKLCH for exactly this reason. Lightness L runs 0 to 1, chroma C runs roughly 0 to 0.4 inside sRGB (further outside, only on wide-gamut displays), hue H is degrees as in HSL. When chroma is zero the color is achromatic and hue is mathematically undefined; this picker normalises that case to H=0.

Tailwind: a curated 244-point palette

Tailwind's default color system is 22 families — slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose — each with 11 shades from 50 (lightest) to 950 (darkest). The 950 shade was added in Tailwind v3.3 (April 2023) — older codebases stop at 900. Black and white round the palette to 244 named colors.

The picker maps any sRGB color to its nearest Tailwind class by computing Euclidean distance in 8-bit channel space and returning the smallest. Δ=0 is an exact palette hit; under 20 is visually indistinguishable; above 50 means the closest shade is a noticeable shift and you should probably extend your config rather than approximate. The lookup runs on every keystroke and never blocks input.

Conversion accuracy and round-trip drift

Going HEX → HSL → HEX is lossy by a maximum of one channel per axis because HSL stores floating-point values that get quantised back to 8-bit on the way out. HEX → OKLCH → HEX can drift by two channels in extreme corners of the gamut because OKLCH passes through a linear-sRGB stage with cube roots that do not invert exactly under floating-point arithmetic. These drifts are below the threshold of perception — the eye cannot tell that your #abcdef came back as #aacdef.

For storage, always treat HEX as the source of truth. The picker's recent-inputs history follows the same rule: only the canonical HEX is persisted, and the four derived forms are recomputed on recall. Two reasons. First, smaller payload. Second, no risk that a future fix to the conversion math produces stale snapshots in your history.

EyeDropper: when the browser cooperates

The EyeDropper API lets a page sample any pixel under the cursor — anywhere on screen, including outside the browser window. The user gesture (clicking the button) is the permission grant; there is no intrusive prompt. The catch is browser support: Chromium-based engines (Chrome 95+, Edge, Opera, Brave) ship it; Firefox and Safari currently do not. The picker detects window.EyeDropper at mount time and disables the button cleanly when it's absent — rather than crashing or pretending to work.

Where OKLCH is heading in production design systems

Design systems are the leading indicator for color-format adoption. IBM Carbon, Adobe Spectrum, GitHub Primer, and the Material Design 3 color system have all migrated their published palettes toward OKLCH or close cousins of it (CAM16-UCS, CIECAM02) over the last three years. The reason is the same in every case: when designers tune contrast pairs or generate dark-mode variants algorithmically, perceptual lightness gives reproducible results across hues; HSL does not. The Design Tokens Community Group standardisation effort also picked OKLCH as the recommended color space for portable token files (W3C editor's draft, 2024). The practical implication: if your team is exporting palettes from Figma to Style Dictionary today, the canonical hand-off is increasingly OKLCH, not HEX — and pasting OKLCH back into the HEX field here gives you the exact sRGB approximation the browser will actually render.

Where the workflow earns its keep

Design-system migration is the heavy use case: you have a brand HEX, you want the closest Tailwind class for a quick prototype, and you want to see what its OKLCH lightness is before you commit to a pairing. Other patterns: tuning dark-mode pairs (hold hue, drop lightness, watch the OKLCH-L number stay sensible), eyeballing accessibility headroom (OKLCH L delta between foreground and background is a usable proxy for WCAG contrast), extracting a color from a screenshot or external app via EyeDropper, or just keeping a working palette in the recent-inputs strip while you sketch.

Frequently asked questions

Why does the same color look slightly different in HEX, HSL and OKLCH?

The values describe the same point in color space, but they are projecting that point through different mathematical lenses. HEX/RGB are raw 8-bit sRGB channels — what the monitor receives as voltage. HSL is a geometric reshuffle of RGB into hue/saturation/lightness; it is intuitive but not perceptually uniform (HSL lightness 50% looks darker for blue than for yellow). OKLCH is calibrated against human perception data — equal lightness numbers actually look equally bright. When you round-trip through different spaces, the small precision losses surface as a ±1 channel drift; the displayed color is identical to the eye.

What does OKLCH offer that HSL does not?

Perceptual uniformity. Björn Ottosson published OKLab in December 2020 by fitting a transformation to empirical color-discrimination data (MacAdam ellipses, Luo-Rigg dataset). The polar form OKLCH was added to the CSS Color Module Level 4 draft a year later. The practical payoff is that interpolation between two OKLCH colors stays on the same perceived hue (HSL famously veers grey through the midpoint), and adjusting lightness moves predictably across hues. Tailwind v4 uses OKLCH internally for its entire palette for this reason.

How does the Tailwind "closest match" work?

Every entry in the v3+ default palette (22 families × 11 shades + black and white, ~244 entries) is preloaded as an 8-bit RGB triple. When you change the color, the picker computes the Euclidean distance √(Δr² + Δg² + Δb²) between your color and every palette entry, and returns the smallest. Δ=0 means an exact palette hit; Δ under 20 is visually indistinguishable; Δ above 50 means the closest Tailwind shade is a noticeable shift. The score is deterministic and runs in under 100µs, so it updates on every keystroke without budget concern.

Why is the EyeDropper button greyed out in my browser?

The EyeDropper API ships in Chromium-based browsers (Chrome 95+, Edge 95+, Opera, Brave) and is not currently implemented in Firefox or Safari. The W3C spec lives at the WICG and has not advanced to Recommendation, so there is no compatibility shim — the picker detects window.EyeDropper at mount time and disables the button cleanly. Workaround: copy a HEX value from your design tool and paste it into the HEX input. Snip-to-sample tools at the OS level (Digital Color Meter on macOS, PowerToys on Windows) also work and run outside the browser entirely.

Why does my color look more vivid on my iPhone than on my work monitor?

Most consumer monitors target the sRGB color gamut (the 1996 web baseline). Modern Apple displays — iPhone, MacBook Pro, iPad Pro — render Display P3, which contains about 25% more color volume than sRGB, with notably stronger reds and greens. CSS supports wide-gamut colors via `color(display-p3 R G B)` (Chrome 111+, Firefox 113+, Safari 10+), but this picker emits sRGB only — that is still the safe default for cross-device consistency. If your brand needs P3 fidelity for a specific device target, generate the sRGB color here and add the P3 declaration as a layered fallback in CSS.

Why do my saved colors only store the HEX value, not RGB and HSL?

Recent inputs are a recall surface, not a snapshot store. The four derived representations (RGB, HSL, OKLCH, Tailwind class) are pure mathematical functions of the canonical HEX — recomputing them on demand takes microseconds and is cheaper than serialising them to localStorage. More importantly, persisting derived outputs would violate the project privacy contract (CLAUDE.md §3.1.5) and risk drift if the conversion math ever ships a fix. The HEX is the source of truth; everything else regenerates from it, byte-equal, every time.

What is the difference between OKLCH lightness and HSL lightness?

HSL lightness is a geometric construction — it splits the RGB cube on its diagonal and reports where on that diagonal your color sits. It does not match how the human eye perceives brightness, which is why HSL lightness 50% reads as a dark midnight blue but a fluorescent yellow. OKLCH lightness is calibrated against psychophysical data: two colors with identical OKLCH-L look equally bright regardless of hue. When you are designing a dark-mode pair or an accessibility-driven palette, OKLCH is the right tool. When you are sketching with a slider next to your editor, HSL is faster.

Can I paste a class name like "hover:bg-red-500" into the Tailwind field?

No — the parser accepts the bare utility form (bg-red-500, text-slate-900, border-emerald-200) without variant prefixes. Variants like hover:, dark:, md: change when the class applies, not which color it represents, so they would be ambiguous in a single-color picker. Strip the variant when you paste, or just use the HEX or RGB input — those round-trip through the same closest-match lookup and emit the same Tailwind class on the other side.