Favorites

CSS <named-color> Data Type

<named-color>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <named-color> data type is a color keyword, such as red, teal or rebeccapurple. CSS defines 148 named colors, plus transparent.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <named-color> CSS data type represents a color given by a predefined keyword, such as red, teal, goldenrod or rebeccapurple. CSS defines 148 named colors (including duplicate spellings such as gray and grey), each mapped to an exact sRGB value. A named color can be used anywhere a <color> is accepted.

Many names come from the original 16 HTML colors, such as black, white, navy and olive. Most of the others come from the X11 color list used in early Unix systems, which is why some names are surprising: darkgray is actually lighter than gray, and green (#008000) is much darker than lime (#00ff00). The most recent addition, rebeccapurple (#663399), was added in memory of Rebecca Meyer.

Named colors are case-insensitive, so Red and RED work too. They are always fully opaque, apart from transparent, which is a separate keyword. Named colors are convenient for quick prototypes and examples, but for brand colors and design systems a precise format such as <hex-color> or oklch() is usually clearer.

Examples:

h1      { color: rebeccapurple; }
.ok     { background-color: palegreen; }
.danger { border-color: crimson; }
.muted  { color: slategray; }

Interactive Demo

Colour swatch
Demo Code
HTML Code
<div class="demo-element">Colour swatch</div>
CSS Code
.demo-element {
	width: 260px;
	padding: 18px;
	border-radius: 8px;
	font-size: 16px;
	font-weight: bold;
	color: #fff;
	text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
	background: rebeccapurple;
}

Syntax

<named-color> = aliceblue | antiquewhite | aqua | ... | yellow | yellowgreen

Values

  • <named-color>One of the 148 predefined color keywords, such as black, white, red, green, blue, orange, purple, rebeccapurple, cornflowerblue or tomato. Keywords are case-insensitive. See CSS Color Names for the full list with their hex values.

Example

<div class="wrap">
<h1>CSS &lt;named-color&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="sw" style="background: rebeccapurple"></div>
<div class="label">rebeccapurple</div>
</div>
<div class="card">
<div class="sw" style="background: cornflowerblue"></div>
<div class="label">cornflowerblue</div>
</div>
<div class="card">
<div class="sw" style="background: tomato"></div>
<div class="label">tomato</div>
</div>
<div class="card">
<div class="sw" style="background: gold"></div>
<div class="label">gold</div>
</div>
<div class="card">
<div class="sw" style="background: seagreen"></div>
<div class="label">seagreen</div>
</div>
<div class="card">
<div class="sw" style="background: lime"></div>
<div class="label">lime</div>
</div>
<div class="card">
<div class="sw" style="background: green"></div>
<div class="label">green</div>
</div>
<div class="card">
<div class="sw" style="background: gray"></div>
<div class="label">gray</div>
</div>
<div class="card">
<div class="sw" style="background: darkgray"></div>
<div class="label">darkgray</div>
</div>
<div class="card">
<div class="sw" style="background: slategray"></div>
<div class="label">slategray</div>
</div>
<div class="card">
<div class="sw" style="background: crimson"></div>
<div class="label">crimson</div>
</div>
<div class="card">
<div class="sw" style="background: papayawhip"></div>
<div class="label">papayawhip</div>
</div>
</div>
<p class="note">Note that darkgray is lighter than gray, and green is much darker than lime.</p>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
.sw {
  height: 64px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS named-color data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.