Color Science & Calculation Methodology
Color Pickers uses standardized mathematical models, colorimetry specifications, and W3C guidelines to perform conversions, generate palettes, and evaluate accessibility metrics. All transformations execute client-side inside your browser engine.
1. Foundational Architecture & Precision
Local Browser Execution
Calculations are computed locally using TypeScript logic running inside the user’s JavaScript runtime. Color values and uploaded images are processed on your device and are not transmitted to remote servers.
Standardized Color Spaces
All RGB and HEX operations assume the standard sRGB gamut (IEC 61966-2-1:1999) with D65 reference white, which is the baseline color model for web browsers and display screens.
2. HEX & RGB Conversions
A hexadecimal color code encodes three 8-bit channels (Red, Green, Blue) as base-16 integers ranging from 00 (0) to FF (255).
For 3-digit shorthand syntax (e.g., #F57), each character is doubled (#FF5577) in accordance with the W3C CSS Color Module Level 3 specification before decoding.
3. HSL & HSV Coordinate Transformations
HSL (Hue, Saturation, Lightness) and HSV (Hue, Saturation, Value) represent cylindrical re-mappings of the sRGB cube:
- Hue ($H$): An angle from 0° to 360° on the color wheel calculated from the dominant RGB channel and channel delta.
- Lightness ($L$): The arithmetic mean of the maximum and minimum normalized RGB components: $L = (max + min) / 2$.
- Value ($V$): The maximum normalized RGB component: $V = max(R, G, B)$.
4. CMYK Subtractive Ink Approximation
CMYK (Cyan, Magenta, Yellow, Key/Black) values are calculated using standard digital subtractive color simulation.
Note: Digital CMYK conversion provides a mathematical model. Physical printing reproduction depends on specific press profiles, paper stock absorption, and ink pigment gamuts (such as SWOP, GRACoL, or FOGRA39).
5. WCAG 2.1 Relative Luminance & Contrast Evaluation
Contrast ratios are evaluated according to the W3C Web Content Accessibility Guidelines (WCAG 2.1 Success Criterion 1.4.3 & 1.4.6).
A. Linear Gamma Expansion (R_linear, G_linear, B_linear)
To calculate luminance, sRGB values (0–255) are normalized to 0.0–1.0 and de-gamma corrected:
B. Relative Luminance ($L$)
C. Contrast Ratio Formula
D. WCAG 2.1 Conformance Thresholds
6. Perceptual Uniformity: OKLab & OKLCH
OKLab is a perceptually uniform color space designed by Björn Ottosson (2020) that models human color perception. OKLCH translates OKLab coordinates into intuitive cylindrical components (Lightness, Chroma, Hue angle).
Linear sRGB is transformed into cone responses (LMS space) using the forward matrix, processed via cubic non-linearity (cubic root x^(1/3)), and mapped onto the orthogonal L, a, b axes.
7. Standardized Color Naming Hierarchy
To maintain consistency across Color-Pickers.com, color names are resolved through a centralized classification rule:
- Official CSS Color Name: Used exclusively when a HEX code exactly matches one of the 148 W3C CSS Color Module Level 4 standardized color keywords (e.g.
#FF0000is "Red",#0000FFis "Blue"). - Approximate Color Name: When a color does not match an exact official W3C CSS keyword, the resolver computes Euclidean distance across RGB color space to return the closest named shade, explicitly designated as an approximate descriptor.