A developer grabs #1A73E8 from the style guide, pastes it into CSS, then needs the same value as rgba() for a transparent overlay. Eyeballing the conversion is how you end up with a button one shade off the nav bar. Converting HEX to RGB or HSL is pure arithmetic, but doing it by hand invites rounding mistakes, especially when you also need a WCAG contrast check.
Paste a colour in any notation to get all three formats, contrast ratios, and harmony palettes ready to copy into code.
HEX, RGB, and HSL: Three Notations for the Same Pixel
HEX is shorthand for RGB: #1A73E8 means R 26, G 115, B 232. HSL rewrites it as hue 217°, saturation 82%, lightness 51%. Same pixel, different mental model. HEX is compact and works well for design tokens. HSL maps to how humans actually think about colour: “make it lighter” means raise L, “mute it” means lower S. RGB sits between, as the format canvas APIs accept directly.
The gotcha: HEX rounds to 8-bit integers (0-255). HSL-to-RGB math often produces fractional values that get floored, so a round trip can shift by ±1 per channel. Pick one canonical format for your tokens and derive the rest.
Why HSL Beats RGB for Generating Tints, Shades, and Palettes
Lightening in RGB means raising all three channels by an amount that depends on the hue. That's guesswork. In HSL you bump L from 50% to 70% and the tint is done, with hue and saturation staying put. Building a five-step scale is a single loop over the lightness axis.
The limit is perceptual uniformity. HSL treats all hues as equally bright at L 50, but yellow looks far brighter than blue at the same L value. CSS’s oklch() fixes this with a perceptually uniform lightness channel, which is better for precision accessibility palettes.
WCAG Contrast Ratios: The Numbers Behind Accessible Text
The WCAG 2.1 guidelines require 4.5:1 for normal text and 3:1 for large text (18px bold / 24px regular). The ratio uses relative luminance, a weighted sum of linearised RGB, not raw 0-255 values. A pair that “looks fine” can fail because the eye compensates better than users with reduced vision.
Alpha complicates it. An rgba() overlay at 60% opacity over white produces a different effective colour than the same overlay over black. Test contrast with the composited colour, not the alpha value alone.
Harmony Rules: Complementary, Analogous, and Triadic in Practice
Complementary colours sit 180° apart on the wheel. Maximum contrast. Good for CTAs. Analogous colours span 30° either side, giving a cohesive, low-contrast pairing. Triadic palettes place three hues 120° apart for a vibrant feel that's hard to balance unless you mute two of the three.
These rules assume sRGB. On a Display P3 monitor a saturated green clips when exported to HEX — the harmony breaks. Stick to sRGB for web unless you explicitly target wide-gamut via CSS color(display-p3 ...).
Quick Interpretation: What Your Converted Values Tell You
The output gives HEX, RGB, and HSL plus contrast ratios against white and black. If the white ratio falls below 4.5, the colour fails WCAG AA for text on light backgrounds. If both ratios are low, the colour sits in mid-lightness and needs a stronger pairing for readable text.
Fast Clarifications on Color Workflow Pitfalls
- sRGB gamut clipping. Wide-gamut displays show colours with no exact HEX equivalent. Exporting silently clips to the nearest sRGB point. Check after conversion.
- Dark-mode inversion. Flipping lightness (L 80 → L 20) doesn't guarantee the same contrast ratio. Re-check every text/background pair after inverting.
- Alpha and contrast. Transparency changes the composited colour the user actually sees but doesn't appear in a raw contrast calculation. Test with the flattened value.
Slips that break design reviews: copying three-digit HEX shorthand (#FFF) into a six-digit field and getting #FFF000 instead of #FFFFFF, and assuming CSS named colours match the same HEX across all browsers.
Related on EverydayBudd's developer utilities hub: the Image DPI & Print Size Calculator for color management when designs go to print rather than screen.
Conversions assume sRGB and 8-bit-per-channel precision. Contrast ratios follow WCAG 2.1 relative-luminance formulas. They don't replace accessibility audits or testing on actual devices and assistive technologies.