User Rating 0.0
Total Usage 0 times
Category CSS Tools
-
Normal text sample Aa Large text Aa
Is this tool helpful?

Your feedback helps us improve.

About

Incorrect color specification causes cascading failures: a hex value off by one digit shifts hue by up to 16 steps, CMYK-to-RGB mismatches produce print output that deviates from screen by 15 - 30% in perceived saturation, and WCAG contrast violations below the 4.5:1 ratio threshold render text illegible for roughly 8% of male users with color vision deficiency. This tool computes bidirectional conversions across six color spaces (sRGB, HSL, HSV, CMYK, CIE LAB, HEX) using the D65 standard illuminant and CIE 1931 observer functions. It approximates CMYK output assuming an idealized ICC profile without ink-density correction. Contrast ratios follow WCAG 2.1 relative luminance: L = 0.2126R + 0.7152G + 0.0722B after gamma linearization.

Color blindness simulation uses the Brettel-Viénot-Mollon transformation matrices for dichromatic vision. Note: simulated output is an approximation. Actual perception varies by severity (anomalous trichromacy vs. full dichromacy) and individual physiology. Pro Tip: always validate critical UI colors against both Protanopia and Deuteranopia simultaneously, as red-green deficiency accounts for over 99% of inherited color vision deficiency cases.

color picker color converter hex to rgb color palette generator wcag contrast checker color harmony color blindness simulator hsl color picker

Formulas

RGB to HSL conversion maps Cartesian color coordinates into cylindrical form. Given normalized channels R′, G′, B′ [0, 1]:

Cmax = max(R′, G′, B′)
Cmin = min(R′, G′, B′)
Δ = Cmax Cmin

L = Cmax + Cmin2

S =
{
0 if Δ = 0Δ1 |2L 1| otherwise

Where Cmax is the maximum channel value, Δ is the chroma range, L is lightness (midpoint of max and min), and S is saturation relative to lightness.

WCAG 2.1 contrast ratio between two colors uses relative luminance:

L = 0.2126Rlin + 0.7152Glin + 0.0722Blin

CR = L1 + 0.05L2 + 0.05

Where Rlin is the linearized sRGB channel: if C 0.04045, then Clin = C ÷ 12.92; otherwise Clin = ((C + 0.055) ÷ 1.055)2.4. L1 is the lighter luminance and L2 the darker.

RGB to CIE LAB requires an intermediate XYZ transform using the D65 illuminant reference white (Xn = 0.95047, Yn = 1.0, Zn = 1.08883):

L* = 116 f(Y ÷ Yn) 16
a* = 500 (f(X ÷ Xn) f(Y ÷ Yn))
b* = 200 (f(Y ÷ Yn) f(Z ÷ Zn))

Where f(t) = t1/3 if t > 0.008856, else f(t) = 7.787t + 16116.

Reference Data

Color SpaceComponentsRangePrimary UsePerceptually Uniform
sRGBR, G, B0 - 255Screen display, CSS, WebNo
HEX6-digit base-16#000000 - #FFFFFFWeb shorthand for RGBNo
HSLH, S, L0 - 360°, 0 - 100%CSS color functions, designNo
HSV/HSBH, S, V0 - 360°, 0 - 100%Photoshop, color pickersNo
CMYKC, M, Y, K0 - 100%Print (subtractive mixing)No
CIE LABL*, a*, b*L: 0 - 100, a/b: ±128Perceptual color differenceYes (approx.)
CIE XYZX, Y, Z0 - 1 (normalized)Intermediate conversion spaceNo
WCAG LuminanceL0 - 1Contrast ratio calculationLinearized sRGB
WCAG 2.1 Contrast Requirements
AA Normal Text4.5:1Body text < 18pt or < 14pt bold
AA Large Text3.0:1Text ≥ 18pt or ≥ 14pt bold
AAA Normal Text7.0:1Enhanced accessibility
AAA Large Text4.5:1Enhanced accessibility, large text
Color Vision Deficiency Prevalence
Protanopia1.0% malesMissing L-cone (red)
Deuteranopia1.0% malesMissing M-cone (green)
Tritanopia0.003%Missing S-cone (blue)
Protanomaly1.1% malesShifted L-cone sensitivity
Deuteranomaly4.6% malesShifted M-cone sensitivity (most common)
Achromatopsia0.003%Complete color blindness, rod monochromacy
Named CSS Color Constants (Selection)
Coral#FF7F50rgb(255, 127, 80)
SlateBlue#6A5ACDrgb(106, 90, 205)
MediumSeaGreen#3CB371rgb(60, 179, 113)
GoldenRod#DAA520rgb(218, 165, 32)
Tomato#FF6347rgb(255, 99, 71)

Frequently Asked Questions

RGB is an additive color model (light emission) while CMYK is subtractive (ink absorption). The gamut of sRGB is larger than typical CMYK profiles in saturated blues and greens but smaller in certain deep cyans. This tool converts using the idealized formula C = (1 − R′ − K)/(1 − K), which does not account for ink density, paper absorption, or dot gain. For production print work, use an ICC profile-aware converter. Expect a ΔE*ab of 3-10 between screen and print for saturated colors.
The contrast ratio uses relative luminance computed from linearized sRGB channels with the ITU-R BT.709 coefficients (0.2126R + 0.7152G + 0.0722B). The ratio formula is (L₁ + 0.05)/(L₂ + 0.05) where L₁ is the brighter luminance. WCAG 2.1 Level AA requires ≥ 4.5:1 for normal text (below 18pt) and ≥ 3.0:1 for large text (≥ 18pt or ≥ 14pt bold). Level AAA requires ≥ 7.0:1 and ≥ 4.5:1 respectively. Non-text UI components require ≥ 3.0:1.
The simulations use the Brettel, Viénot, and Mollon (1997) dichromatic simulation matrices, which model complete absence of one cone type (dichromacy). Real-world color vision deficiency exists on a spectrum: most affected individuals have anomalous trichromacy (shifted cone sensitivity) rather than full dichromacy. The simulation therefore represents the most severe case. Tritanopia simulation is less validated due to its extreme rarity (0.003% prevalence). For critical accessibility decisions, supplement with user testing.
Both are cylindrical remappings of RGB. HSL defines Lightness as the midpoint of the max and min channel: L = (Cmax + Cmin)/2. HSV defines Value as simply the max channel: V = Cmax. In practice, HSL's 50% lightness corresponds to the "purest" color, making it intuitive for CSS (the hsl() function). HSV's 100% value includes whites at low saturation, matching the behavior of Photoshop's color picker. Use HSL for web/CSS work and HSV for image editing workflows.
The a* axis spans green (negative) to red (positive), and the b* axis spans blue (negative) to yellow (positive). These are opponent-color dimensions derived from the XYZ transform via a nonlinear function (cube root above the threshold, linear below). A color with a* = −40 and b* = +60 would be a greenish-yellow. The range is theoretically unbounded but for sRGB gamut colors typically stays within ±128. Values outside this indicate out-of-gamut colors for sRGB.
Color harmonies are geometric relationships on the HSL/HSV hue wheel (0-360°). Complementary colors sit 180° apart and produce maximum contrast. Analogous colors are within ±30° and create visual cohesion. Triadic colors are 120° apart, providing balanced vibrancy. Split-complementary uses ±150° from the base, offering contrast with less tension than pure complementary. These rules apply to the perceptual hue wheel. Note: the sRGB hue wheel is not perceptually uniform - a 30° shift near yellow appears much larger than the same shift near blue in LAB space.