Note that the list of accepted color values have been extended as the specification has evolved, culminating with the latest CSS3 colors.

Associated with the color in the sRGB space, a <color> value also consists of an alpha-channel coordinate, transparency value, indicating how the color should composite with its background color.

Though CSS color values are precisely defined, they may appear differently on different output devices. Most of them are not calibrated, and some browsers do not support output devices' color profile. Without these, color rendering may vary a lot.

Note: The WCAG 2.0 recommendation from the W3C strongly advises web authors not to use color as the only mean to convey a specific information, action or result. Some users have problems distinguishing colors and the conveyed information may not be grasped. Of course, this doesn't prevent the usage of color, only its usage as the only mean to describe some information.

Interpolation

Values of the <color> CSS data type can be interpolated in order to perform animations or for creating <gradient> values. In that case they are interpolated on each of their red, green, blue components, each handled as a real, floating-point number. Note that interpolation of colors happens in the alpha-premultiplied sRGBA color space to prevent unexpected grey colors to appear. In animations, the speed of the interpolation is determined by the timing function associated with the animation.

Values

There are several ways to describe a <color> value.

Color keywords

Color keywords are case-insensitive identifiers which represent a specific color, e.g. red, blue, brown, lightseagreen. The name describes the color, though it is mostly artificial. The list of accepted values varied a lot through the different specification:

CSS Level 1 only accepted 16 basic colors, named the VGA colors as they were taken from the set of displayable colors on VGA graphic cards.

CSS Level 2 added the orange keyword.

From the beginning, browsers accepted other colors, mostly the X11 named colors list as some early browsers were X11 applications, though with a few differences. SVG 1.0 was the first standard to formally define these keywords; CSS Colors Level 3 also formally defined these keywords. They are often referred as the extended color keywords, the X11 colors, or the SVG colors.

There are a few caveats to consider when using keywords:

Except the 16 basic colors which are common with HTML, the others cannot be used in HTML. HTML will convert these unknown values with a specific algorithm which will lead to completely different colors. These keywords should only be used in SVG & CSS.

Unknown keywords make the CSS property invalid. Invalid properties being ignored, the color will have no effect. This is a different behavior than the one of HTML.

No keyword-defined colors in CSS have any transparency, they are plain, solid colors.

Several keywords denote the same colors:

darkgray / darkgrey

darkslategray / darkslategrey

dimgray / dimgrey

lightgray / lightgrey

lightslategray / lightslategrey

gray / grey

slategray / slategrey

Though the names of the keywords have been taken by the usual X11 color names, the color may diverge from the corresponding system color on X11 system as these are tailored for the specific hardware by the manufacturer .

The color rebeccapurple is equivalent to the color #639, and more information about why it was introduced can be found in this Codepen blog post by Trezy "Honoring a Great Man."

transparent keyword

The transparent keyword represents a fully transparent color, i.e. the color seen will be the background color. Technically, it is a black with alpha channel at its minimum value and is a shortcut for rgba(0,0,0,0).

Historical Note
The transparent keyword wasn't a true color in CSS Level 2 (Revision 1). It was a specific keyword that could be used in place of a regular <color> value on two CSS properties: background and border. It was essentially added to allow to override an inherited solid colors.

With the support of opacity through alpha channels, transparent was redefined as a true color in CSS Colors Level 3 allowing its use in any place where a <color> value is required, like the color property.

currentColor keyword

The currentColor keyword represents the calculated value of the element's color property. It allows to make the color properties inherited by properties or child's element properties that do not inherit it by default.

It can also be used on properties that inherit the calculated value of the element's color property and will be equivalent to the inherit keyword on these elements, if any.

Live example

The color of the line (a color-filled div) adapts to the color of its color property, inherited from its parent.

Live example 1

<div style="color:darkred">
The color of this text is the same as the one of the line:
<div style="background:currentcolor; height:1px"></div>
Some more text.
</div>

Live example 2

<div style="color:blue; border-bottom: 1px dashed currentcolor;">
The color of this text is the same as the one of the line:
<div style="background:currentcolor; height:1px"></div>
Some more text.
</div>

Colors also can be defined the Hue-saturation-lightness model (HSL) using the hsl() functional notation. The advantage of HSL over RGB is that it is far more intuitive: you can guess at the colors you want, and then tweak. It is also easier to create sets of matching colors (by keeping the hue the same and varying the lightness/darkness, and saturation).

Hue is represented as an angle of the color circle (i.e. the rainbow represented in a circle). This angle is given as a unitless <number>. By definition red=0=360, and the other colors are spread around the circle, so green=120, blue=240, etc. As an angle, it implicitly wraps around such that -120=240 and 480=120.

Saturation and lightness are represented as percentages.100% is full saturation, and0% is a shade of grey.100%lightness is white, 0% lightness is black, and 50% lightness is "normal".

Colors can be defined in the Red-green-blue-alpha model (RGBa) in two ways:

Hexadecimal notation #RRGGBBAA and #RGBA

"#", followed by eight hexadecimal characters (0-9, A-F), where the first two digits represent the red part, the second two the green part, the third two the blue part and the last two the transparency.

"#", followed by four hexadecimal characters (0-9, A-F), where the first digit represents the red part, the second the green part, the third one the blue part and the last one the transparency.

The four-digit RGB notation (#RGBA) and the eight-digit form (#RRGGBBAA) are equal, for example, #f038 and #ff003388 represent the same color.

using the rgba() functional notation.

RGBa extends the RGB color model to include the alpha channel, allowing specification of the opacity of a color.a means opacity: 0=transparent; 1=opaque;

Colors can be defined in the hue-saturation-lightness-alpha model (HSLa) using the hsla() functional notation. HSLa extends the HSL color model to include the alpha channel, allowing specification of the opacity of a color.a means opacity: 0=transparent; 1=opaque;

System Colors

Not all system colors are supported on all systems. for use on public web pages.

ActiveBorder

Active window border.

ActiveCaption

Active window caption. Should be used with CaptionText as foreground color.

AppWorkspace

Background color of multiple document interface.

Background

Desktop background.

ButtonFace

Face background color for 3-D elements that appear 3-D due to one layer of surrounding border. Should be used with the ButtonText foreground color.

ButtonHighlight

The color of the border facing the light source for 3-D elements that appear 3-D due to that layer of surrounding border.

ButtonShadow

The color of the border away from the light source for 3-D elements that appear 3-D due to that layer of surrounding border.

ButtonText

Text on push buttons. Should be used with the ButtonFace or ThreeDFace background color.

CaptionText

Text in caption, size box, and scrollbar arrow box. Should be used with the ActiveCaption background color.

GrayText

Grayed (disabled) text.

Highlight

Item(s) selected in a control. Should be used with the HighlightText foreground color.

HighlightText

Text of item(s) selected in a control. Should be used with the Highlight background color.

InactiveBorder

Inactive window border.

InactiveCaption

Inactive window caption. Should be used with the InactiveCaptionText foreground color.

InactiveCaptionText

Color of text in an inactive caption. Should be used with the InactiveCaption background color.

InfoBackground

Background color for tooltip controls. Should be used with the InfoText foreground color.

InfoText

Text color for tooltip controls. Should be used with the InfoBackground background color.

Menu

Menu background. Should be used with the MenuText or -moz-MenuBarText foreground color.

MenuText

Text in menus. Should be used with the Menu background color.

Scrollbar

Background color of scroll bars.

ThreeDDarkShadow

The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.

ThreeDFace

The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Should be used with the ButtonText foreground color.

ThreeDHighlight

The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border.

ThreeDLightShadow

The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two
concentric layers of surrounding border.

ThreeDShadow

The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.

Window

Window background. Should be used with the WindowText foreground color.

WindowFrame

Window frame.

WindowText

Text in windows. Should be used with the Window background color.

Mozilla System Color Extensions

-moz-ButtonDefault

The border color that goes around buttons that represent the default action for a dialog box.

-moz-ButtonHoverFace

The background color of a button that the mouse pointer is over (which would be ThreeDFace or ButtonFace when the mouse pointer is not over it). Should be used with the -moz-ButtonHoverText foreground color.

-moz-ButtonHoverText

The text color of a button that the mouse pointer is over (which would be ButtonText when the mouse pointer is not over it). Should be used with the -moz-ButtonHoverFace background color.

-moz-CellHighlight

Background color for selected item in a tree widget. Should be used with the -moz-CellHighlightText foreground color. See also -moz-html-CellHighlight.

-moz-CellHighlightText

Text color for a selected item in a tree. Should be used with the -moz-CellHighlight background color. See also -moz-html-CellHighlightText.

-moz-Combobox

Background color for combo-boxes. Should be used with the -moz-ComboboxText foreground color. In versions prior to 1.9.2, use -moz-Field instead.

-moz-ComboboxText

Text color for combo-boxes. Should be used with the -moz-Combobox background color. In versions prior to 1.9.2, use -moz-FieldText instead.

-moz-Dialog

Background color for dialog boxes. Should be used with the -moz-DialogText foreground color.

-moz-DialogText

Text color for dialog boxes. Should be used with the -moz-Dialog background color.

-moz-dragtargetzone

-moz-EvenTreeRow

Background color for even-numbered rows in a tree. Should be used with the -moz-FieldText foreground color. In Gecko versions prior to 1.9, use -moz-Field. See also -moz-OddTreeRow.

-moz-Field

Text field background color. Should be used with the -moz-FieldText foreground color.

-moz-FieldText

Text field text color. Should be used with the -moz-Field, -moz-EvenTreeRow, or -moz-OddTreeRow background color.

-moz-html-CellHighlight

Background color for highlighted item in HTML <select>s. Should be used with the -moz-html-CellHighlightText foreground color. Prior to Gecko 1.9, use -moz-CellHighlight.

-moz-html-CellHighlightText

Text color for highlighted items in HTML <select>s. Should be used with the -moz-html-CellHighlight background color. Prior to Gecko 1.9, use -moz-CellHighlightText.

-moz-mac-accentdarkestshadow

-moz-mac-accentdarkshadow

-moz-mac-accentface

-moz-mac-accentlightesthighlight

-moz-mac-accentlightshadow

-moz-mac-accentregularhighlight

-moz-mac-accentregularshadow

-moz-mac-chrome-active

-moz-mac-chrome-inactive

-moz-mac-focusring

-moz-mac-menuselect

-moz-mac-menushadow

-moz-mac-menutextselect

-moz-MenuHover

Background color for hovered menu items. Often similar to Highlight. Should be used with the -moz-MenuHoverText or -moz-MenuBarHoverText foreground color.

-moz-MenuHoverText

Text color for hovered menu items. Often similar to HighlightText. Should be used with the -moz-MenuHover background color.

-moz-MenuBarText

Text color in menu bars. Often similar to MenuText. Should be used on top of Menu background.

-moz-MenuBarHoverText

Color for hovered text in menu bars. Often similar to -moz-MenuHoverText. Should be used on top of -moz-MenuHover background.

-moz-nativehyperlinktext

Default platform hyperlink color.

-moz-OddTreeRow

Background color for odd-numbered rows in a tree. Should be used with the -moz-FieldText foreground color. In Gecko versions prior to 1.9, use -moz-Field. See also -moz-EvenTreeRow.

-moz-win-communicationstext

Should be used for text in objects with -moz-appearance: -moz-win-communications-toolbox;.

-moz-win-mediatext

Should be used for text in objects with -moz-appearance: -moz-win-media-toolbox.

Mozilla Color Preference Extensions

-moz-activehyperlinktext

User's preference for text color of active links. Should be used with the default document background color.

-moz-default-background-color

User's preference for the document background color.

-moz-default-color

User's preference for the text color.

-moz-hyperlinktext

User's preference for the text color of unvisited links. Should be used with the default document background color.

-moz-visitedhyperlinktext

User's preference for the text color of visited links. Should be used with the default document background color.