Home/Developer, Code & Web Engineering Tools/Color Picker & Contrast Checker (WCAG)

Color Picker & Contrast Checker (WCAG)

Inspect color contrast ratios against WCAG 2.1 and Section 508 accessibility guidelines with live HSL/RGB sliders and color vision deficiency simulations.

Color Engine & Sliders

#
Curated Accessible Presets
RGB & HSL Precision TuningLum: 0.117
Red Channel (R)79
Green Channel (G)70
Blue Channel (B)229
Lightness (L)59%
Saturation (S)75%
Calculated Contrast Ratio
6.29:1
AA PassMeets WCAG 2.1 AA Normal

WCAG 2.1 Accessibility Matrix

AA Normal
Req: 4.5:1Pass (Body Text)
AA Large
Req: 3.0:1Pass (18pt+ / 14pt Bold)
AA UI Elements
Req: 3.0:1Pass (Borders/Icons)
AAA Normal
Req: 7.0:1Fail
AAA Large
Req: 4.5:1Enhanced Pass
Section 508
Federal US StdCompliant
Live Render Preview

Accessible Typography Heading

This interactive preview validates how readable body paragraphs, button components, and micro-copy appear to end users under selected luminance settings.

Color Vision Deficiency Simulations
ProtanopiaRatio: 6.87:1
Sample
DeuteranopiaRatio: 6.98:1
Sample
TritanopiaRatio: 3.08:1
Sample
AchromatopsiaRatio: 6.79:1
Sample
ISO 9241-307 / WCAG 2.1 Linear MathsRGB Gamma: 2.4

Mathematical Foundations: Relative Luminance & Contrast Ratios

Under the Web Content Accessibility Guidelines (WCAG 2.1), visual contrast is computed from the relative luminance ($L$) of two colors on an sRGB display. Relative luminance corresponds to the perceived brightness of any point in a colorspace, normalized between 0.0 for pure black ($#000000$) and 1.0 for pure white ($#FFFFFF$).

sRGB Gamma Expansion

Because computer monitors render color logarithmically rather than linearly, raw 8-bit RGB channels ($C_sRGB \in [0, 255]$) must first be linearized:

C_linear = (C / 255) <= 0.04045 ? (C / 255) / 12.92 : ((C / 255 + 0.055) / 1.055) ^ 2.4

Photopic Spectral Weighting

Linearized RGB components are multiplied by ITU-R Recommendation BT.709 coefficients matching human eye cone spectral sensitivity:

L = 0.2126 * R_linear + 0.7152 * G_linear + 0.0722 * B_linear

The Contrast Ratio Formula

Given relative luminances $L_1$ (lighter color) and $L_2$ (darker color), the contrast ratio is defined as:

(L₁ + 0.05) / (L₂ + 0.05)

The constant offset of 0.05 accounts for ambient light flares reflected off typical display glass, ensuring ratios scale proportionally from 1:1 up to 21:1.

WCAG 2.1 & Section 508 Compliance Threshold Reference

Accessibility legislation across the United States (Section 508, ADA Title II), the European Union (EN 301 549), and global standard bodies require digital applications to satisfy WCAG Level AA thresholds at a minimum.

UI Element TypeSize / Weight DefinitionLevel AA MinimumLevel AAA Enhanced
Normal Body Text< 18pt regular (< 24px) or < 14pt bold (< 18.5px)4.5:17.0:1
Large Heading Text≥ 18pt regular (≥ 24px) or ≥ 14pt bold (≥ 18.5px)3.0:14.5:1
User Interface ControlsInput borders, toggle switches, active states3.0:1N/A (3.0:1 Baseline)
Graphical Glyphs & IconsNavigation arrows, infographic pie slices, badges3.0:1N/A (3.0:1 Baseline)
Incidental / Inactive UIDisabled buttons, decorative photography backgroundExempt (0:1)Exempt (0:1)

Color Vision Deficiencies (CVD) & Universal Design

Approximately 1 in 12 men (8%) and 1 in 200 women worldwide live with some form of color vision deficiency. Relying solely on color hue (such as red for error, green for success) without maintaining adequate luminance contrast or text labels violates WCAG Criterion 1.4.1 (Use of Color).

Protanopia & Protanomaly (Red-Weak)

Caused by defective or absent L-cones (long wavelength). Pure red appears dark brown or black, shifting warm hues toward muddy olives and golds.

Deuteranopia & Deuteranomaly (Green-Weak)

The most prevalent form of dichromacy, affecting M-cones. Green and red converge toward brownish yellows, making subtle status chips indistinguishable without strict luminance differences.

Tritanopia (Blue-Yellow Deficiency)

Extremely rare deficiency affecting S-cones (short wavelength). Blue colors shift toward teal or gray, while yellows appear pink or light violet.

Achromatopsia (Total Monochromacy)

Total absence of functional cone photopigments. Vision is perceived purely via rods in grayscale shades, relying 100% on luminance contrast.

Step-by-Step UI Accessibility Case Studies

Review real-world design adjustments to elevate failing brand colors into fully compliant design system tokens:

Case A: Electric Cyan on White CanvasFailing AA
  • Initial Setup: Cyan (#00E5FF, Lum: 0.72) on Pure White (#FFFFFF, Lum: 1.0).
  • Calculation: (1.0 + 0.05) / (0.72 + 0.05) = 1.36:1.
  • Audit Verdict: Fails all WCAG criteria (below 3:1). Unreadable for low-vision users.
  • Remediation: Shift cyan text to deep teal (#005F73, Lum: 0.10).
  • • Result: Contrast jumps to 7.00:1 (Full AAA Pass).
Case B: Slate Border on Dark Mode CardUI Component
  • Initial Setup: Border (#334155, Lum: 0.05) on Dark Card (#0F172A, Lum: 0.01).
  • Calculation: (0.05 + 0.05) / (0.01 + 0.05) = 1.67:1.
  • Audit Verdict: Fails WCAG 1.4.11 Non-text Contrast (requires 3.0:1).
  • Remediation: Elevate border luminance to Slate 400 (#94A3B8, Lum: 0.36).
  • • Result: Ratio becomes 6.83:1 (Exceeds 3.0:1 requirement).

Frequently Asked Questions (FAQ)

What are the official WCAG 2.1 color contrast thresholds?

WCAG 2.1 Level AA mandates a minimum contrast ratio of 4.5:1 for regular body text (below 18pt or 14pt bold) and 3.0:1 for large text (18pt+ or 14pt+ bold) and graphical UI components. WCAG 2.1 Level AAA mandates 7.0:1 for normal text and 4.5:1 for large text.

How is relative luminance calculated under WCAG standards?

Relative luminance normalizes non-linear sRGB channels into linear space via gamma expansion (values ≤ 0.04045 divide by 12.92; otherwise ((C + 0.055) / 1.055)^2.4), and computes weighted spectral efficiency: L = 0.2126*R + 0.7152*G + 0.0722*B.

Why is a 3:1 ratio required for UI components and form borders?

Under WCAG 2.1 Success Criterion 1.4.11 (Non-text Contrast), visual information required to identify interactive UI controls (such as input borders, focus indicators, and chart glyphs) must maintain at least a 3.0:1 ratio against adjacent background pixels.

What is the difference between WCAG 2.1 and APCA (Advanced Perceptual Contrast Algorithm)?

WCAG 2.1 uses a simple mathematical luminance ratio that treats dark-on-light and light-on-dark symmetrically. APCA (developed for future WCAG 3 drafts) calculates lightness contrast based on human spatial frequency vision, font weights, and polarity. WCAG 2.1 AA/AAA remains the legally enforceable global standard.

Does this tool store or transmit my color palette data?

No. All hex parsing, color matrix multiplication, and luminance derivations happen locally in your web browser client using pure TypeScript without outbound network requests.

Found this tool helpful? Share it with others!

Share on Facebook
Share on X
Share on LinkedIn
Copy URL

Related & Complementary Utilities

Explore more privacy-first client-side web tools.