Color keywords are case-insensitive identifiers representing a specific <color>
, such as red
, blue
, black
, or lightseagreen
. Although the names more or less describe their respective colors, they are essentially artificial, without a strict rationale behind the terms used.
All keywords specify a color in the sRGB color space.
There are a few caveats to consider when using color keywords:
- HTML only recognizes the 16 basic color keywords (
black
,silver
,gray
,white
,maroon
,red
,purple
,fuchsia
,green
,lime
,olive
,yellow
,navy
,blue
,teal
, andaqua
). - An algorithm converts all other values (a CSS color keyword or a random string) to a color (leading most of the time to completely different colors than the CSS color associated in the table below). Therefore, color keywords beside these 16 values should only be used in CSS and SVG, but not in HTML.
- Unlike HTML, CSS completely ignores unknown keywords.
- The color keywords all represent plain, solid colors without transparency.
- Several keywords are aliases for each other:
-
aqua
/cyan
-
fuchsia
/magenta
-
darkgray
/darkgrey
-
darkslategray
/darkslategrey
-
dimgray
/dimgrey
-
lightgray
/lightgrey
-
lightslategray
/lightslategrey
-
gray
/grey
-
slategray
/slategrey
-
- Though many keywords have been adapted from X11, their RGB values may differ from the corresponding color on X11 systems since manufacturers sometimes tailor X11 colors to their specific hardware.
- In addition to the color keywords, the
<color>
data type supports other keywords:transparent
to create a wholly transparent color,currentColor
that represents the value of an element'scolor
property lets you use thecolor
value on properties that do not receive it by default, as well as system color keywords that represents colors that matches those of the OS.