Color Space Coordinate Transformations & Luminance Math
Color spaces map continuous visible wavelengths into discrete numerical coordinate axes. Converting from additive RGB space to cylindrical HSL is modeled as follows:
1. RGB to HSL Hue Angle Formula
H = 60° ×
G - BC_max - C_min
(when C_max = R)2. WCAG Relative Luminance & Contrast Ratio
L = 0.2126 R_lin + 0.7152 G_lin + 0.0722 B_lin⟶Contrast =
L_1 + 0.05L_2 + 0.05
Step-by-Step Color Space Translation Breakdown
Step 1: Normalize Integer RGB Channels to [0, 1] Range
R' = 59 / 255 = 0.231, G' = 130 / 255 = 0.510, B' = 246 / 255 = 0.965
Step 2: Calculate Extrema & Lightness
C_max = 0.965 (Blue), C_min = 0.231 (Red), Δ = 0.734
Lightness L = (0.965 + 0.231) / 2 = 59.8% ≈ 60%
Lightness L = (0.965 + 0.231) / 2 = 59.8% ≈ 60%
Step 3: Cylindrical HSL Angle Mapping
HSL Output=hsl(217deg, 91%, 60%)
Color Models Comparison Matrix
| Model | Channels & Range | Primary Domain | Best Use Case |
|---|---|---|---|
| HEX | #RRGGBB (00 to FF) | Web / CSS / HTML | Compact string notation in styles |
| RGB | R, G, B (0 - 255) | Monitors & Screen Hardware | Canvas APIs & WebGL shaders |
| HSL | H (0-360°), S (0-100%), L (0-100%) | Design Systems & UI | Creating tonal themes and hover states |
| CMYK | C, M, Y, K (0 - 100%) | Print & Publishing | Physical offset ink presses |