CSS Reference ยท Units and Values
Named colors
Reference for CSS named colors: the color keyword list, grey and gray spellings, rebeccapurple, plus the special keywords currentcolor and transparent.
A named color is a keyword that stands for a specific color, such as tomato, navy or lightseagreen. CSS defines about 148 of them (counting both gray and grey spellings), and you can use any of them wherever a <color> is accepted: color, background-color, border-color, fill and so on. Names are case-insensitive.
Two special keywords sit beside the named colors. transparent is a fully transparent color. currentcolor means "the element's current color value", so a border or shadow can follow the text color automatically.
.alert { color: darkred; background: mistyrose; border: 2px solid currentcolor; box-shadow: 0 0 0 4px transparent; }
Try it
Syntax
<named-color> = aliceblue | antiquewhite | aqua | ... | yellow | yellowgreen <color> = <named-color> | currentcolor | transparent | <hex> | <color-function> | ...
There are about 148 names, and the full list is defined by the CSS Color specification; the examples here show a small slice.
Values
| Group | Examples |
|---|---|
| Basic | black, white, red, green, blue, yellow, orange, purple |
| Light and dark variants | lightblue, darkblue, lightgreen, darkgreen, lightgray |
| Fancy names | tomato, coral, salmon, khaki, orchid, peru, sienna |
| Gray spellings | gray and grey, slategray and slategrey, and so on; both work |
| Added later | rebeccapurple (#663399), the only color added after CSS3 |
| Special | transparent, currentcolor |
Usage notes
- Names are not intuitive.
greenis a dark#008000; the bright green islime.grayis darker thandarkgray. Use hex,rgb()oroklch()when you need a precise color. currentcolorfor icons and borders. Settingborder-color: currentcolororfill: currentcolorkeeps them in sync with the text color, which helps theming and hover states.transparentin gradients. Use the same hue with zero alpha (rgb(37 99 235 / 0)) if you notice a gray cast in a fade.- Contrast. Names say nothing about readability. Test text/background pairs for sufficient contrast.
- Case and quotes.
Tomatoworks;"tomato"(quoted) does not, because it is an identifier, not a string. - System colors differ.
Canvas,ButtonTextand friends are not fixed colors; see system colors.
Browser support
All named colors are supported in every current browser, including rebeccapurple. currentcolor and transparent are universally supported.
Related
colorโ text colorbackground-color- system colors
- color values
- Lesson: Colors