Why the same color has four notations
A color is not a number; it is a set of three intensities that a display mixes. HEX, RGB, HSL and HSV are four ways of writing those same three numbers, and each one is convenient for a different job. CSS authors type hex because it is short. Design tools show HSL because it is easier to nudge a hue. Color pickers are built on HSV because that is the space where dragging a point feels like picking a color. Print people live in percentages.
The practical consequence: converting between them is lossless. A hex value and its RGB form are the same instruction to the screen. If a conversion tool shows a slightly different color after a round trip, it is rounding somewhere, not doing anything useful.
What each notation actually means
HEX is RGB written in base 16. The short form #f00 expands to #ff0000 — each digit is doubled. Four- and eight-digit forms add an alpha channel (#f008 is red with half opacity), which is why pasting a 4-digit hex into a tool that only accepts 6 digits produces a wrong color rather than an error.
RGB writes the three channels as integers from 0 to 255, or as percentages. Both are valid CSS, and they are not interchangeable digit for digit: rgb(50%) is 127.5, which browsers round to 128, not 127. That half-pixel difference is exactly where hand-written converters go wrong.
HSL is hue in degrees (0–360), saturation and lightness in percent. It is the format to reach for when you want to keep a hue and change how light the color is, because lightness moves independently.
HSV (also called HSB) uses the same hue, but the other two axes are saturation and value. HSV describes a color as a pure hue with white or black mixed in, which is why pickers use it: the top-right corner of the box is the pure hue, the bottom is black.
| Format | Example | Best for |
|---|---|---|
| HEX | #1b7f79 | CSS, design handoff, short values |
| RGB | rgb(27 127 121) | Channels you need to compute with |
| HSL | hsl(176 65% 29%) | Keeping a hue while changing lightness |
| HSV | hsv(176 79% 50%) | Picker geometry, quick "same hue, different brightness" work |
Contrast is the part that gets products rejected
WCAG defines contrast as a ratio between two relative luminances, from 1:1 (identical) to 21:1 (black on white). The formula weights the green channel most heavily, because human vision is most sensitive to it:
(L1 + 0.05) / (L2 + 0.05), where L is relative luminance after each channel is linearized out of sRGB.
The thresholds worth memorizing:
- 4.5:1 — normal body text, AA.
- 3:1 — large text (about 18pt, or 14pt bold) at AA, and also the minimum for UI components and graphical objects.
- 7:1 — normal text at AAA.
- 4.5:1 — large text at AAA.
Two traps that catch people after the checker says pass. First, the ratio is computed on the colors as written, not on what the browser actually renders: a semi-transparent text color over a background is mathematically a different color, so the safe move is to flatten the alpha yourself and check the result. Second, passing AA on a color pair does not mean the layout passes — text over a gradient or an image is a contrast problem that a single pair cannot express.
Tints, shades and why you want a ramp, not one color
A tint is the color mixed with white; a shade is the color mixed with black. Nine evenly spaced steps from a light tint to a dark shade give you the set most design systems use for hover, active, disabled and border states. Working from a ramp rather than inventing values keeps a UI coherent: the button, its hover state and its focus ring are recognizably the same color at different weights.
One caution: mixing in sRGB is not the same as mixing in a perceptual space, so a 50% tint of a saturated blue looks brighter than you might expect. That is fine for UI states as long as you judge the result visually rather than trusting the arithmetic.
Getting the value out without breaking it
Copy the format the destination expects. Three failure modes account for most broken pastes:
- Alpha dropped. Going from
#1b7f7980to a six-digit hex silently makes the color opaque. - Percentages read as integers.
rgb(27% 50% 47%)is notrgb(27 50 47)— the first is a muted teal, the second is a dark one. - Hue without its unit. HSL hue is degrees; a bare number in some tools is radians or a 0–1 fraction.
Nothing leaves the page
Every conversion and every contrast calculation runs in JavaScript against values in the form. There is no upload, no account, no saved palette, and no request carrying the colors you are working on — which matters when a color pair encodes an unreleased brand system. Verify it in the network panel: changing a value produces no outbound request.
Check before you commit the value
Three things, in order: paste the value into the real stylesheet and look at it on the actual background; check the contrast of the final pair, not the pair you designed in isolation; and keep the notation consistent across the codebase, because a mix of hex and rgba for the same token is how a design system drifts.
Back to all SizeGlide tools.