CSS Color Names: Where They Came From and How Color Matching Works
CSS lets you write color: tomato or background: papayawhip and the browser understands. There are 148 of these named colors, and their names range from the obvious (red) to the oddly specific (lightgoldenrodyellow). They are handy for prototypes, demos and teaching, and they make a useful shared vocabulary when you need to describe a color in words. The list also has some strange history.
Where the names came from
The first versions of HTML and CSS defined just 16 basic colors, taken from the Windows VGA palette: black, silver, gray, white, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal and aqua. CSS 2.1 added orange as the 17th.
The longer list came from the X Window System, the graphics system used on Unix workstations. Its color names file (rgb.txt) dates to the 1980s and was edited by many people over the years, which explains the eclectic mix: peachpuff, navajowhite, blanchedalmond, cornflowerblue. Early browsers supported these X11 names, and CSS3 eventually standardised them as “extended color keywords”.
The most recent addition is rebeccapurple (#663399), added in 2014 in memory of Rebecca Meyer, the daughter of CSS pioneer Eric Meyer, who died on her sixth birthday. Purple was her favorite color. It is the only named color added for this kind of reason, and it is a small, human piece of web history.
The quirks
Because the X11 list and the original HTML list were merged rather than designed together, there are inconsistencies:
| Name | HEX | Quirk |
|---|---|---|
| gray | #808080 | From the HTML/VGA list |
| darkgray | #A9A9A9 | From X11, where gray was #BEBEBE, so darkgray is lighter than CSS gray |
| green | #008000 | HTML green is dark; X11 green was pure #00FF00, which became lime |
| aqua / cyan | #00FFFF | Two names, same color |
| fuchsia / magenta | #FF00FF | Two names, same color |
| grey / gray | #808080 | Both spellings accepted for every gray name |
Counting duplicate spellings, CSS has 148 keywords; removing duplicates leaves about 139 distinct colors. There is also transparent and currentColor, which are keywords but not fixed colors.
Named colors versus HEX in real projects
| Aspect | Named colors | HEX / RGB / HSL |
|---|---|---|
| Readability | Excellent | Poor (HEX) to good (HSL) |
| Precision | Fixed set of ~139 colors | Any of 16.7 million (or more) |
| Brand accuracy | Rarely matches a brand | Exact |
| Teaching and demos | Ideal | Distracting |
| Production design systems | Rarely used | Standard |
Named colors are perfect for prototypes, CSS tutorials and debugging (a quick outline: 2px solid red to see an element’s bounds). For brand work, use exact values stored as tokens.
Finding the name of any color
Often you have a HEX code and want a human name: for a design token label, an alt-text description, a product listing, or just to describe a color in a meeting. Since a named color list is small, the solution is to find the closest named color. But “closest” is trickier than it sounds.
Why RGB distance is misleading
You could measure the straight-line distance between two colors in RGB space. The problem is that RGB isn’t perceptually uniform: a change of 20 units in the green channel is much more visible than 20 units of blue, and changes in dark colors look different from changes in light colors. RGB distance often picks a match that looks obviously wrong.
Lab and Delta E
The CIE developed the **L\*a\b\ (Lab) color space in 1976 specifically so that equal numeric distances correspond to roughly equal perceived differences. L is lightness, a runs from green to red, and b from blue to yellow. The distance between two colors in Lab is called Delta E (ΔE)**.
| ΔE (CIE76) | What it means |
|---|---|
| Under 1 | Not perceptible to most people |
| 1–2 | Perceptible on close inspection |
| 2–10 | Noticeable at a glance |
| 11–49 | Colors are clearly different but related |
| 100 | Opposite colors |
Later formulas (CIE94, CIEDE2000) refine the calculation further, especially for blues and saturated colors, and are used in print and textile quality control. For finding a name from a list of 139 colors, CIE76 is accurate enough and very fast. The color name finder above converts your color and every named color to Lab, sorts by ΔE and shows the closest matches with their distances.
Using color names well
- In design tokens, keep the exact value but consider a descriptive comment, like
--brand-primary: #4A6C8F; /* close to steelblue */. - In writing and product descriptions, use plain names (“dusty blue”) rather than CSS keywords, which can sound odd to customers.
- In accessibility, describe colors only when they matter. A product photo’s alt text might say “steel blue jacket”; a decorative background doesn’t need a description.
- When the ΔE is large, no CSS name fits well. Describe by hue, lightness and saturation instead: “a muted, medium-dark teal”.
If you want to explore beyond named colors, convert values between formats with the color converter, or read our explanation of HEX, RGB, HSL and CMYK.