Colour tools for picking, converting and proving it's readable.
Pick a colour, convert between notations, build a gradient, generate a palette, and check that the result is actually legible. The contrast checker is the one that saves you from shipping text nobody can read.
Colour work splits into two halves that get treated as one. The first is aesthetic — which colours look right together. The second is mechanical and has correct answers: whether two colours have enough contrast to be readable, what a hex value is in RGB, what CSS to write for a gradient. The tools here handle the second half well enough that you can spend your attention on the first.
Which colour tool do you need?
Two of these produce colour, three transform it, and one is a reference.
| If you want to… | Use | Worth knowing |
|---|---|---|
| Pick a colour and get its code in every notation | Color Picker | Gives HEX, RGB, HSL and the nearest named colour at once, so you can paste whichever your codebase uses. |
| Convert between HEX and RGB | HEX ↔ RGB Converter | Three-digit shorthand expands by doubling each digit — #abc is #aabbcc, not #abc000. |
| Build a CSS gradient | Gradient Generator | Gradients between saturated complementary colours pass through a muddy grey midpoint. Adding a midpoint stop fixes it. |
| Check text is legible against its background | Contrast Checker | The only tool here with a pass/fail answer. 4.5:1 for body text at AA, 3:1 for large text. |
| Generate a harmonious set of colours | Color Palette Generator | Complementary, analogous and triadic schemes are starting points — they still need contrast checking before use. |
| Look up the 148 named CSS colours | Named CSS Colors | Useful for prototyping and for decoding someone else's stylesheet. 'Gray' and 'grey' both work; 'darkgray' is lighter than 'gray'. |
All 6 colour tools
Each has its own page with the conversion maths or the standard it implements written out.
HEX, RGB and HSL describe the same colours differently
All three notations address the same sRGB colour space. Converting between them is lossless and purely a change of writing.
HEX is three bytes in hexadecimal: #RRGGBB, each pair from 00 to FF. It is compact and the convention in most design tools. Its three-digit shorthand expands by doubling each digit, so #f0a means #ff00aa — a detail that bites people writing it by hand.
RGB is the same three channels in decimal, rgb(255, 0, 170), with an optional alpha channel. Easier to manipulate arithmetically, which is why it is what JavaScript tends to produce.
HSL re-describes the colour as hue (0–360° around a colour wheel), saturation and lightness. This is the one worth knowing, because it maps to how people actually think. Making a colour "a bit darker" means subtracting from L and nothing else — in HEX it means recomputing three values. Building a palette of tints and shades is trivial in HSL and fiddly everywhere else.
The practical workflow: choose in HSL, store in HEX, and let the converter move between them.
Contrast ratios, and why a colour you like may still fail
WCAG contrast is a ratio between the relative luminance of two colours, running from 1:1 (identical) to 21:1 (black on white). The thresholds that matter:
- 4.5:1 — minimum for normal body text at AA, the level most accessibility requirements reference.
- 3:1 — minimum for large text at AA, meaning 18pt and above, or 14pt bold and above. Also the minimum for interactive component boundaries and meaningful graphics.
- 7:1 — AAA for body text. Worth aiming at for long-form reading.
The formula weights the channels unevenly — green contributes far more to perceived luminance than blue does. This produces results that look wrong until you understand why. Pure yellow on white is nearly illegible at about 1.07:1, while pure blue on white passes comfortably at 8.6:1, despite blue looking darker and more "contrasty" to many people. Two colours of similar lightness but wildly different hue can fail badly: mid-red on mid-green is a classic failure that also disappears entirely for the most common form of colour blindness.
Two things the ratio does not account for. Font weight and size matter physically — thin 12px text at exactly 4.5:1 is harder to read than the number suggests, which is why the large-text allowance exists. And a ratio is not a design: text at 21:1 in a cramped layout still reads poorly.
Where the checker earns its place is on the colours you were going to use anyway — brand colours, a palette from a generator, a mid-grey that looked fine on your monitor. Mid-greys on white are the single most common real-world failure, and they fail quietly.
Building a palette you can actually build an interface from
Colour-wheel schemes — complementary, analogous, triadic — produce colours that relate to each other pleasantly. They do not produce an interface palette, because an interface needs far more than five pretty hues.
What a working palette needs:
- A full range of each colour, not one value. A usable blue is really eight to ten blues from near-white to near-black. Tints for backgrounds, mid values for fills, dark values for text on light backgrounds. In HSL this is one hue at varying lightness.
- Neutrals that are not pure grey. Greys carrying a few degrees of your brand hue make an interface feel coherent. Pure
#808080alongside a warm brand colour looks dead. - Semantic colours. Success, warning, error and info have strong conventions. Deviating from green/amber/red costs comprehension for no gain.
- Contrast-checked pairings. For every background in the palette, know which text colours pass against it. This is the step that gets skipped and the one that causes rework.
A pragmatic order: use the palette generator to find two or three base hues, expand each into a lightness range, then run every text-on-background pairing you plan to use through the contrast checker before any of it reaches code.
Why your gradient has a grey band through the middle
CSS interpolates gradients by moving linearly through RGB, channel by channel. That sounds neutral and is not.
Take a gradient from saturated blue to saturated yellow. Halfway, each channel is averaged, and the result is a desaturated grey-brown. The endpoints are vivid and the middle is mud. The further apart two hues are on the colour wheel, the worse this gets, because the shortest path through RGB space between them passes near the centre — where all colours are grey.
Three reliable fixes:
- Add a midpoint stop. Insert a saturated colour at 50% that sits between the endpoints on the wheel. A blue-to-yellow gradient through green stays vivid throughout.
- Keep endpoints closer in hue. Analogous gradients — blue to teal, orange to red — have no muddy midpoint to begin with, which is why most well-regarded gradients are built from neighbouring hues.
- Vary lightness and saturation rather than hue. A gradient from a dark saturated blue to a light desaturated blue reads as depth, and cannot go muddy.
Banding is a separate problem: visible steps instead of a smooth blend, most noticeable in subtle gradients across large areas. It happens because 8 bits per channel cannot express enough intermediate values over a long distance. Adding a slight noise texture is the standard remedy. The generator shows the CSS live, so a muddy midpoint is visible before it ships.
Designing for the eyes that will actually see it
Around 8% of men and 0.5% of women have some form of colour vision deficiency. In a product with any meaningful user base, that is thousands of people, and the most common form — deuteranomaly, reduced green sensitivity — makes red and green hard to separate.
The single most valuable rule follows directly: never let colour be the only thing carrying information. A red/green status dot is invisible as a distinction to a significant minority. The same dot with a distinct shape, an icon, or a text label works for everyone. Chart series distinguished only by hue have the same problem, solved by pattern, direct labelling, or varying lightness as well as hue.
Varying lightness is the quiet fix that helps across the board. Two colours that differ in lightness remain distinguishable under every form of colour vision deficiency and in greyscale, which also covers monochrome printing and bright-sunlight viewing. If a palette still works converted to greyscale, it will work for almost everyone.
Contrast ratios help here too, since luminance — which the WCAG formula measures — is largely preserved under colour vision deficiency. A pairing that passes the contrast check is likely to remain legible even when the hues are perceived differently.
Frequently asked questions
What contrast ratio do I actually need?
4.5:1 for normal body text and 3:1 for large text to meet WCAG AA, which is the level most legal and procurement requirements reference. AAA asks for 7:1 on body text and is worth aiming at for long-form reading.
Does #abc really mean #aabbcc?
Yes. Three-digit shorthand doubles each digit. It is a frequent source of surprise when a hand-written shorthand produces a different colour than expected.
Why does yellow text fail contrast on white when it looks bright?
Because the formula measures luminance, not vividness, and yellow is extremely luminous — very close to white. Pure yellow on white sits near 1.07:1, which is effectively invisible.
Are HEX, RGB and HSL interchangeable?
Yes, they describe the same sRGB colours in different notations, and conversion between them is lossless. HSL is easier to reason about when you want tints and shades of one hue.
Why does my gradient look muddy in the middle?
CSS interpolates through RGB, and the midpoint between two distant hues lands near grey. Add a saturated colour stop at 50%, or choose endpoints closer together on the colour wheel.
Is a colour-wheel palette enough for a real interface?
No. A scheme gives you base hues; an interface needs a lightness range for each, near-neutral greys, conventional semantic colours, and contrast-checked text pairings.
How many named CSS colours are there?
148, including both 'gray' and 'grey' spellings for the relevant names. The naming is historical rather than systematic, which is why 'darkgray' is lighter than 'gray'.