Real-time color space converter between HEX, RGB, HSL, and modern OKLCH. Features live WCAG AA/AAA contrast analysis, color harmony swatches, and CSS gradient & box-shadow generators.
box-shadow: 0px 10px 25px -5px rgba(56, 189, 248, 0.4);
Verify You're Human
Understanding Digital Color Spaces & Web Accessibility
Color representation on computer screens is fundamentally an additive process where varying intensities of red, green, and blue phosphor subpixels blend together. However, how we mathematically express those intensities dramatically alters our ability to build harmonious palettes, maintain WCAG contrast compliance, and manipulate gradients without muddy grey dead-zones.
Color Models Compared: HEX vs RGB vs HSL vs OKLCH
HEX & sRGB: Hexadecimal color (#38bdf8) is simply a compact base-16 representation of 8-bit red (56), green (189), and blue (248) channels. While native to computer graphics hardware, it is non-intuitive for human designers to adjust lightness or saturation manually.
HSL (Hue, Saturation, Lightness): Cylindrical coordinate representation of sRGB. Hue represents the 360° color wheel angle, saturation indicates color purity (0% to 100%), and lightness controls tint/shade. However, HSL is not perceptually uniform: yellow at 50% lightness appears drastically brighter to the human eye than blue at 50% lightness.
OKLCH (Oklab Lightness, Chroma, Hue): The modern CSS Color Module Level 4 standard. OKLCH is perceptually uniform: increasing lightness by 10% looks identically brighter regardless of hue. It also provides access to the Display P3 wide gamut on modern Apple and OLED screens.
WCAG 2.1 Color Contrast Standards
The Web Content Accessibility Guidelines (WCAG) specify minimum relative luminance contrast ratios between foreground text and background colors:
Level AA (Minimum): Requires a contrast ratio of at least 4.5:1 for normal body text, and 3.0:1 for large text (18pt+ or 14pt bold) and active UI components.
Level AAA (Enhanced): Requires a contrast ratio of at least 7.0:1 for normal text, and 4.5:1 for large text.
Frequently Asked Questions
Can I use OKLCH colors in production CSS today?
Yes. OKLCH is supported across all major evergreen browsers (Chrome 111+, Safari 15.4+, Firefox 113+, Edge 111+), representing over 93% of global web users.
Why do CSS gradients sometimes look washed out in the middle?
Standard sRGB linear gradients interpolate linearly along RGB coordinates, which frequently dips into desaturated muddy greys. Using OKLCH interpolation (linear-gradient(in oklch 90deg, #38bdf8, #a78bfa)) preserves vibrant saturation throughout the transition.