Understanding Web Color Models
Color on the web is represented through three primary models: HEX (hexadecimal), RGB (Red-Green-Blue), and HSL (Hue-Saturation-Lightness). Each serves different purposes in CSS, web design, and color theory. This tool converts instantly between all three and also identifies CSS named colors and complementary hues.
HEX Color Codes
HEX is the most common color format in web development. Written as #RRGGBB, each hex pair represents a color channel intensity from 00 to FF (0–255). With 256 values per channel, HEX supports 16,777,216 colors (256³). A 3-digit shorthand exists: #RGB expands to #RRGGBB (e.g., #F06 = #FF0066). HEX is used everywhere: CSS (color: #FF5733;), HTML, Figma, Photoshop, and brand guidelines.
RGB Color Model
RGB is the additive color model of digital displays. Values range 0–255 per channel. rgb(255, 0, 0) = red, rgb(0, 255, 0) = green, rgb(128, 128, 128) = gray. CSS supports rgb() and rgba() (with alpha transparency 0–1). RGB maps directly to how monitors emit light through red, green, and blue sub-pixels.
HSL Color Model
HSL is more intuitive for designers. Hue (0–360°): color type on the wheel — 0°=red, 60°=yellow, 120°=green, 180°=cyan, 240°=blue, 300°=magenta. Saturation (0–100%): color intensity — 0%=gray, 100%=vivid. Lightness (0–100%): brightness — 0%=black, 50%=normal, 100%=white. Creating tints and shades is trivial in HSL: keep hue and saturation constant, vary lightness.
Complementary Colors
Complementary colors sit 180° apart on the color wheel, creating maximum contrast. Pairs: Red ↔ Cyan, Green ↔ Magenta, Blue ↔ Yellow. Essential for high-contrast UI design, call-to-action buttons, and data visualization.
Web Accessibility
About 8% of men and 0.5% of women have color vision deficiency. WCAG 2.1 AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Never convey information through color alone.
CSS Named Colors
CSS defines 148 named colors (red, navy, coral, teal, etc.). This tool identifies named colors automatically. Named colors improve CSS readability but cover only a small fraction of the 16.7 million possible colors.
Privacy
All color calculations run entirely in your browser. No data is sent to any server.
Comments