Candidate Recommendation Draft · css-color

CSS Color

2 properties, 1 at-rule, 17 functions, 8 types defined by this specification, 22 of them known to at least one browser (the others are badged Not in any browser yet).

Each feature in detail

color

Property Baseline: widely availablesince January 2018

MDN The color CSS media feature can be used to test the number of bits per color component (red, green, blue) of the output device.

Syntax

<color>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
CanvasText
Applies to
all elements and text
Inherited
yes
Percentages
N/A
Computed value
computed color, see resolving color values
Canonical order
per grammar
Animation type
by computed value type

Browser support

First browser version supporting color
Chrome 1
Edge 12
Firefox 2
Safari 3
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

opacity

Property Baseline: widely availablesince January 2018

MDN The opacity CSS property sets the opacity of an element. Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency.

Live preview Example from MDN
#example-element {
  background-color: #963770;
  color: white;
  padding: 1em;
}

Syntax

<opacity-value>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
1
Applies to
all elements
Inherited
no
Percentages
map to the range [0,1]
Computed value
specified number, clamped to the range [0,1]
Canonical order
per grammar
Animation type
by computed value type

Browser support

First browser version supporting opacity
Chrome 1
Edge 12
Firefox 1
Safari 2
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

@color-profile

At-rule Not in any browser yet

Spec The @color-profile rule defines and names a color profile which can later be used in the color() function to specify a color.

MDN The @color-profile CSS at-rule defines and names a color profile which can later be used in the color() function to specify a color.

Syntax

@color-profile [<dashed-ident> | device-cmyk] { <declaration-list> }

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Descriptors

components
<ident># Initial: n/a
rendering-intent
relative-colorimetric | absolute-colorimetric | perceptual | saturation Initial: relative-colorimetric
src
<url> Initial: n/a

alpha()

Function Baseline: newly availablesince September 2026 Modern CSS: alpha()

MDN The alpha() CSS function takes an origin color and returns that same color with a modified alpha (transparency) channel. The color components of the origin color are preserved unchanged. The result is in the same color space as the origin color.

Live preview Example from MDN
:root {
  --my-color: oklch(60% 0.25 315 / 0.3);

  /* Same color, but with alpha set to 80% */
  --my-color-80: alpha(from var(--my-color) / 80%);
}

.box1 {
  background-color: var(--my-color);
}

.box2 {
  background-color: var(--my-color-80);
}

body {
  font-family: sans-serif;
  display: flex;
  gap: 10%;
  justify-content: center;
}

div {
  width: 40%;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

Syntax

alpha(from <color> / [<alpha-value> | none])

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting alpha()
Chrome 152
Edge 152
Firefox 155
Safari 27
Chrome Android 152
Safari iOS 27

First version with support, from MDN browser-compat-data.

color-layers()

Function Not in any browser yet

Spec The color-layers() functional notation takes an optional <blend-mode> followed by a list of two or more <color> layers.

Syntax

color-layers([ <blend-mode>, ]? <color># )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

color-mix()

Function Baseline: widely availablesince November 2025 Modern CSS: color-mix() with three or more colorsModern CSS: color-mix()

MDN The color-mix() functional notation takes one or more <color> values and returns the result of mixing them in a given colorspace by a given amount.

Live preview Example from MDN
ul {
  display: flex;
  list-style-type: none;
  font-size: 150%;
  gap: 10px;
  border: 2px solid;
  padding: 10px;
}

li {
  padding: 10px;
  flex: 1;
  box-sizing: border-box;
  font-family: monospace;
  outline: 3px solid #a71e14;
  text-align: center;
}

li:nth-child(1) {
  background-color: color-mix(in oklab, #a71e14 0%, white);
}

li:nth-child(2) {
  background-color: color-mix(in oklab, #a71e14 25%, white);
}

li:nth-child(3) {
  background-color: color-mix(in oklab, #a71e14 50%, white);
}

li:nth-child(4) {
  background-color: color-mix(in oklab, #a71e14 75%, white);
}

li:nth-child(5) {
  background-color: color-mix(in oklab, #a71e14 100%, white);
}

li:nth-child(6) {
  background-color: color-mix(in oklab, #a71e14, white);
}

Syntax

color-mix( <color-interpolation-method>? , [ <color> && <percentage [0,100]>? ]#)

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting color-mix()
Chrome 111
Edge 111
Firefox 113
Safari 16.2
Chrome Android 111
Safari iOS 16.2

First version with support, from MDN browser-compat-data.

color()

Function Baseline: widely availablesince November 2025 Modern CSS: Relative colorsModern CSS: color()

MDN The color() functional notation allows a color to be specified in a particular, specified color space rather than the implicit sRGB color space that most of the other color functions operate in.

Live preview Example from MDN
div {
  width: 50px;
  height: 50px;
  padding: 5px;
  margin: 5px;
  display: inline-block;
  border: 1px solid black;
}

[data-color="red-a98-rgb"] {
  background-color: color(a98-rgb 1 0 0);
}
[data-color="red-prophoto-rgb"] {
  background-color: color(prophoto-rgb 1 0 0);
}
/* sRGB gamut, linear-light — full brightness (green channel 100%) */
[data-color="green-srgb-linear"] {
  background-color: color(srgb-linear 0 1 0);
}
/* P3 gamut (wider), gamma-encoded — low brightness (green channel ~21% light output) */
[data-color="green-display-p3"] {
  background-color: color(display-p3 0 0.5 0);
}
/* P3 gamut (wider), linear-light — half brightness (green channel at 50% light output) */
[data-color="green-display-p3-linear"] {
  background-color: color(display-p3-linear 0 0.5 0);
}
[data-color="blue-rec2020"] {
  background-color: color(rec2020 0 0 1);
}
[data-color="blue-srgb"] {
  background-color: color(srgb 0 0 1);
}

Syntax

color( [from <color>]? <colorspace-params> [ / [ <alpha-value> | none ] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting color()
Chrome 111
Edge 111
Firefox 113
Safari 15
Chrome Android 111
Safari iOS 15

First version with support, from MDN browser-compat-data.

contrast-color()

Function Baseline: newly availablesince April 2026 Modern CSS: contrast-color()

Spec The contrast-color() functional notation identifies a sufficiently contrasting color against a specified background or foreground color without requiring manual computation.

MDN The contrast-color() CSS function takes a color value and returns a contrasting color. The function commonly ensures the WCAG AA minimum contrast. The browsers may use different and better algorithms.

Live preview Example from MDN
:root {
  --button-color: lightblue;
}

button {
  background-color: var(--button-color);

  /* Set contrasting text color automatically */
  color: contrast-color(var(--button-color));
}

body {
  padding: 1rem;
}

button {
  margin: 3rem;
  padding: 1rem;
  width: 150px;
  font-size: 2rem;
  border-radius: 1rem;
}

@supports not (color: contrast-color(red)) {
  body::before {
    content: "Your browser doesn't support the contrast-color() function.";
    background-color: wheat;
    display: block;
    text-align: center;
    padding: 1rem 0;
  }
}

Syntax

contrast-color( [ [ <color> && [ tbd-fg | tbd-bg ] && <target-contrast>? ] | [ <color> && [ tbd-fg | tbd-bg ] && <target-contrast>, <color># ] ] )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting contrast-color()
Chrome 147
Edge 147
Firefox 146
Safari 26
Chrome Android 147
Safari iOS 26

First version with support, from MDN browser-compat-data.

device-cmyk()

Function Not in any browser yet

MDN The device-cmyk() functional notation is used to express CMYK colors in a device dependent way, specifying the cyan, magenta, yellow, and black components.

Syntax

<legacy-device-cmyk-syntax> | <modern-device-cmyk-syntax>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

hsl()

Function Baseline: widely availablesince July 2022 Modern CSS: Relative colors

MDN The hsl() functional notation expresses a color in the sRGB color space according to its hue, saturation, and lightness components. An optional alpha component represents the color's transparency.

Live preview Example from MDN
#example-element {
  min-width: 100%;
  min-height: 100%;
  padding: 10%;
}

Syntax

[ <legacy-hsl-syntax> | <modern-hsl-syntax> ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting hsl()
Chrome 1
Edge 12
Firefox 1
Safari 3.1
Chrome Android 18
Safari iOS 2

First version with support, from MDN browser-compat-data.

hsla()

Function

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

[ <legacy-hsla-syntax> | <modern-hsla-syntax> ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting hsla()
Chrome 1
Edge 12
Firefox 1
Safari 3.1
Chrome Android 18
Safari iOS 2

First version with support, from MDN browser-compat-data.

hwb()

Function Baseline: widely availablesince October 2024 Modern CSS: Relative colors

MDN The hwb() functional notation expresses a color in the sRGB color space according to its hue, whiteness, and blackness. An optional alpha component represents the color's transparency.

Live preview Example from MDN
#example-element {
  min-width: 100%;
  min-height: 100%;
  padding: 10%;
}

Syntax

hwb([from <color>]? [<hue> | none] [<percentage> | <number> | none] [<percentage> | <number> | none] [ / [<alpha-value> | none] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting hwb()
Chrome 101
Edge 101
Firefox 96
Safari 15
Chrome Android 101
Safari iOS 15

First version with support, from MDN browser-compat-data.

lab()

Function Baseline: widely availablesince November 2025 Modern CSS: Relative colorsModern CSS: Lab and LCH

MDN The lab() functional notation expresses a given color in the CIE L\*a\*b\* color space.

Live preview Example from MDN
body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
div {
  height: 50px;
  flex: 0 0 28%;
  border: 1px solid black;
}

[data-color="red-dark"] {
  background-color: lab(5 125 71);
}
[data-color="red"] {
  background-color: lab(40 125 71);
}
[data-color="red-light"] {
  background-color: lab(95 125 71);
}

[data-color="green-dark"] {
  background-color: lab(10% -120 125);
}
[data-color="green"] {
  background-color: lab(50% -120 125);
}
[data-color="green-light"] {
  background-color: lab(90% -120 125);
}

[data-color="blue-dark"] {
  background-color: lab(10 -120 -120);
}
[data-color="blue"] {
  background-color: lab(50 -120 -120);
}
[data-color="blue-light"] {
  background-color: lab(90 -120 -120);
}

Syntax

lab([from <color>]? [<percentage> | <number> | none] [<percentage> | <number> | none] [<percentage> | <number> | none] [ / [<alpha-value> | none] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting lab()
Chrome 111
Edge 111
Firefox 113
Safari 15
Chrome Android 111
Safari iOS 15

First version with support, from MDN browser-compat-data.

lch()

Function Baseline: widely availablesince November 2025 Modern CSS: Relative colorsModern CSS: Lab and LCH

MDN The lch() functional notation expresses a given color using the LCH color space, which represents lightness, chroma, and hue. It uses the same L axis as the lab() color function of the CIELab color space, but it uses the polar coordinates C (Chroma) and H (Hue).

Live preview Example from MDN
body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
div {
  height: 50px;
  border: 1px solid black;
}

[data-color="blue-dark"] {
  background-color: lch(10% 100 240);
}
[data-color="blue"] {
  background-color: lch(50% 100 240);
}
[data-color="blue-light"] {
  background-color: lch(90% 100 240);
}

[data-color="red-dark"] {
  background-color: lch(10% 130 20);
}
[data-color="red"] {
  background-color: lch(50% 130 20);
}
[data-color="red-light"] {
  background-color: lch(90% 130 20);
}

[data-color="green-dark"] {
  background-color: lch(10% 132 130);
}
[data-color="green"] {
  background-color: lch(50% 132 130);
}
[data-color="green-light"] {
  background-color: lch(90% 132 130);
}

Syntax

lch([from <color>]? [<percentage> | <number> | none] [<percentage> | <number> | none] [<hue> | none] [ / [<alpha-value> | none] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting lch()
Chrome 111
Edge 111
Firefox 113
Safari 15
Chrome Android 111
Safari iOS 15

First version with support, from MDN browser-compat-data.

light-dark()

Function Baseline: newly availablesince May 2024 Modern CSS: light-dark() image valuesModern CSS: light-dark()

MDN The light-dark() CSS function accepts two colors or two images and returns a color or an image based on the active color scheme, without needing a prefers-color-scheme media feature.

Live preview Example from MDN
:root {
  /* this has to be set to switch between light or dark */
  color-scheme: light dark;

  --light-bg: ghostwhite;
  --light-color: darkslategray;
  --light-code: tomato;

  --dark-bg: darkslategray;
  --dark-color: ghostwhite;
  --dark-code: gold;
}
* {
  background-color: light-dark(var(--light-bg), var(--dark-bg));
  color: light-dark(var(--light-color), var(--dark-color));
}
code {
  color: light-dark(var(--light-code), var(--dark-code));
}

.light {
  /* forces light color-scheme */
  color-scheme: light;
}
.dark {
  /* forces dark color-scheme */
  color-scheme: dark;
}

section {
  padding: 0.8rem;
}

Syntax

<light-dark-color> | <light-dark-image>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting light-dark()
Chrome 123
Edge 123
Firefox 120
Safari 17.5
Chrome Android 123
Safari iOS 17.5

First version with support, from MDN browser-compat-data.

oklab()

Function Baseline: widely availablesince November 2025 Modern CSS: Relative colorsModern CSS: Oklab and OkLCh

MDN The oklab() functional notation expresses a given color in the Oklab color space, which attempts to mimic how color is perceived by the human eye.

Live preview Example from MDN
body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
div {
  height: 50px;
  flex: 0 0 28%;
  border: 1px solid black;
}

[data-color="red-dark"] {
  background-color: oklab(0.05 0.4 0.4);
}
[data-color="red"] {
  background-color: oklab(0.5 0.4 0.4);
}
[data-color="red-light"] {
  background-color: oklab(0.95 0.4 0.4);
}

[data-color="green-dark"] {
  background-color: oklab(5% -100% 0.4);
}
[data-color="green"] {
  background-color: oklab(50% -100% 0.4);
}
[data-color="green-light"] {
  background-color: oklab(95% -100% 0.4);
}

[data-color="blue-dark"] {
  background-color: oklab(0.05 -0.3 -0.4);
}
[data-color="blue"] {
  background-color: oklab(0.5 -0.3 -0.4);
}
[data-color="blue-light"] {
  background-color: oklab(0.95 -0.3 -0.4);
}

Syntax

oklab([from <color>]? [<percentage> | <number> | none] [<percentage> | <number> | none] [<percentage> | <number> | none] [ / [<alpha-value> | none] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting oklab()
Chrome 111
Edge 111
Firefox 113
Safari 15.4
Chrome Android 111
Safari iOS 15.4

First version with support, from MDN browser-compat-data.

oklch()

Function Baseline: widely availablesince November 2025 Modern CSS: Relative colorsModern CSS: Oklab and OkLCh

MDN The oklch() functional notation expresses a given color in the Oklab color space. oklch() is the cylindrical form of oklab(), using the same L axis, but with polar Chroma (C) and Hue (h) coordinates.

Live preview Example from MDN
body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
div {
  height: 50px;
  border: 1px solid black;
}

[data-color="blue-dark"] {
  background-color: oklch(10% 0.4 240);
}
[data-color="blue"] {
  background-color: oklch(50% 0.4 240);
}
[data-color="blue-light"] {
  background-color: oklch(90% 0.4 240);
}

[data-color="red-dark"] {
  background-color: oklch(10% 0.4 20);
}
[data-color="red"] {
  background-color: oklch(50% 0.4 20);
}
[data-color="red-light"] {
  background-color: oklch(90% 0.4 20);
}

[data-color="green-dark"] {
  background-color: oklch(10% 0.4 130);
}
[data-color="green"] {
  background-color: oklch(50% 0.4 130);
}
[data-color="green-light"] {
  background-color: oklch(90% 0.4 130);
}

Syntax

oklch([from <color>]? [<percentage> | <number> | none] [<percentage> | <number> | none] [<hue> | none] [ / [<alpha-value> | none] ]? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting oklch()
Chrome 111
Edge 111
Firefox 113
Safari 15.4
Chrome Android 111
Safari iOS 15.4

First version with support, from MDN browser-compat-data.

rgb()

Function Baseline: widely availablesince July 2022 Modern CSS: Relative colors

MDN The rgb() functional notation expresses a color in the sRGB color space according to its red, green, and blue components. An optional alpha component represents the color's transparency.

Live preview Example from MDN
#example-element {
  min-width: 100%;
  min-height: 100%;
  padding: 10%;
}

Syntax

[ <legacy-rgb-syntax> | <modern-rgb-syntax> ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting rgb()
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

rgba()

Function Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

[ <legacy-rgba-syntax> | <modern-rgba-syntax> ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

wcag2()

Function Not in any browser yet

Spec The wcag2 keyword and wcag2() functional notations indicate use of the [WCAG21] luminance contrast algorithm. Their syntax is:

Defined for

contrast-color()

This feature only appears in the context of these properties, functions or types.

<alpha-value>

Type Not in any browser yet

MDN The <alpha-value> CSS data type represents a value that can be either a <number> or a <percentage>, specifying the alpha channel or transparency of a color.

Syntax

/* for <color> */
<number> | <percentage>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Defined for

<color>

This feature only appears in the context of these properties, functions or types.

<color-interpolation-method>

Type Baseline: widely availablesince November 2025

MDN The <color-interpolation-method> CSS data type represents the color space used for interpolation between <color> values. It can be used to override the default interpolation color space for color-related functional notations such as color-mix() and linear-gradient().

Live preview Example from MDN
.gradient {
  height: 50px;
  width: 100%;
}
.srgb {
  background-image: linear-gradient(in srgb to right, blue, red);
}
.oklab {
  background-image: linear-gradient(in oklab to right, blue, red);
}
.oklch-longer {
  background-image: linear-gradient(in oklch longer hue to right, blue, red);
}

Syntax

in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? | <custom-color-space> ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <color-interpolation-method>
Chrome 111
Edge 111
Firefox 113
Safari 16.2
Chrome Android 111
Safari iOS 16.2

First version with support, from MDN browser-compat-data.

<color>

Type Baseline: widely availablesince January 2018

Spec Colors in CSS are represented by the <color> type:

MDN The <color> CSS data type represents a color. A <color> may also include an alpha-channel transparency value, indicating how the color should composite with its background.

Live preview Example from MDN
div {
  height: 200px;
  width: 200px;
}

Syntax

<color-base> | currentColor | <system-color> | <contrast-color()> | <device-cmyk()> | <light-dark-color>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <color>
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

<hex-color>

Type Baseline: widely availablesince July 2022

Spec The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits. In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).

MDN The <hex-color> CSS data type is a notation for describing the hexadecimal color syntax of an sRGB color using its primary color components (red, green, blue) written as hexadecimal numbers, as well as its transparency.

Live preview Example from MDN
body {
  display: flex;
  justify-content: space-evenly;
  font-family: monospace;
}
div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

[class] {
  width: 40px;
  height: 40px;
}
.c1 {
  background: #f09;
}
.c2 {
  background: #f09a;
}
.c3 {
  background: #ff0099;
}
.c4 {
  background: #ff0099aa;
}

Browser support

First browser version supporting <hex-color>
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

<hue-interpolation-method>

Type Baseline: newly availablesince June 2024 Modern CSS: Gradient interpolation

MDN The <hue-interpolation-method> CSS data type represents the algorithm used for interpolation between hue values. The interpolation method specifies how to find a midpoint between two hue values based on a color wheel. It is used as a component of the <color-interpolation-method> data type.

Live preview Example from MDN
div {
  border: 1px solid black;
  height: 50px;
  margin: 10px;
  width: 90%;
}
p {
  color: white;
  margin: 6px;
}

/* Fallback styles */
.hsl,
.hsl-shorter,
.hsl-named {
  background: linear-gradient(
    to right,
    hsl(39 100% 50%),
    hsl(46 100% 50%),
    hsl(53 100% 50%),
    hsl(60 100% 50%)
  );
}
.hsl-increasing {
  background: linear-gradient(
    to right,
    hsl(190 100% 50%),
    hsl(225 100% 50%),
    hsl(260 100% 50%),
    hsl(295 100% 50%),
    hsl(330 100% 50%),
    hsl(365 100% 50%),
    hsl(400 100% 50%),
    hsl(435 100% 50%),
    hsl(470 100% 50%),
    hsl(505 100% 50%),
    hsl(540 100% 50%)
  );
}
.hsl-decreasing,
.hsl-longer,
.hsl-named-longer {
  background: linear-gradient(
    to right,
    hsl(399 100% 50%),
    hsl(368 100% 50%),
    hsl(337 100% 50%),
    hsl(307 100% 50%),
    hsl(276 100% 50%),
    hsl(245 100% 50%),
    hsl(214 100% 50%),
    hsl(183 100% 50%),
    hsl(152 100% 50%),
    hsl(122 100% 50%),
    hsl(91 100% 50%),
    hsl(60 100% 50%)
  );
}

.hsl {
  background: linear-gradient(
    to right in hsl,
    hsl(39deg 100% 50%),
    hsl(60deg 100% 50%)
  );
}
.hsl-increasing {
  background: linear-gradient(
    to right in hsl increasing hue,
    hsl(190deg 100% 50%),
    hsl(180deg 100% 50%)
  );
}
.hsl-decreasing {
  background: linear-gradient(
    to right in hsl decreasing hue,
    hsl(39deg 100% 50%),
    hsl(60deg 100% 50%)
  );
}
.hsl-shorter {
  background: linear-gradient(
    to right in hsl shorter hue,
    hsl(39deg 100% 50%),
    hsl(60deg 100% 50%)
  );
}
.hsl-longer {
  background: linear-gradient(
    to right in hsl longer hue,
    hsl(39deg 100% 50%),
    hsl(60deg 100% 50%)
  );
}
.hsl-named {
  background: linear-gradient(to right in hsl, orange, yellow);
}
.hsl-named-longer {
  background: linear-gradient(to right in hsl longer hue, orange, yellow);
}

Syntax

[ shorter | longer | increasing | decreasing ] hue

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <hue-interpolation-method>
Chrome 111
Edge 111
Firefox 127
Safari 16.2
Chrome Android 111
Safari iOS 16.2

First version with support, from MDN browser-compat-data.

<hue>

Type Baseline: widely availablesince July 2022

MDN The <hue> CSS data type represents the hue angle of a color. It is used in the color functions that accept hue expressed as a single value, specifically hsl(), hwb(), lch(), and oklch() functional notations.

Live preview Example from MDN
div {
  width: 100px;
  height: 100px;
  margin: 10px;
  border: 1px solid black;
}
p {
  font-family: sans-serif;
}
span {
  font-family: monospace;
  background: rgb(0 0 0 / 10%);
  padding: 3px;
}
#hue-slider {
  width: 90%;
}

#box {
  background-color: hsl(0 100% 50%);
}

Syntax

<number> | <angle>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <hue>
Chrome 1
Edge 12
Firefox 1
Safari 3.1
Chrome Android 18
Safari iOS 2

First version with support, from MDN browser-compat-data.

<named-color>

Type Baseline: widely availablesince January 2018

Spec CSS defines a large set of named colors, so that common colors can be written and read more easily. A <named-color> is written as an <ident>, accepted anywhere a <color> is. As usual for CSS-defined <ident>s, all of these keywords are ASCII case-insensitive.

MDN The <named-color> CSS data type is the name of a color, such as red, blue, black, or lightseagreen. Syntactically, a <named-color> is an ident.

Live preview Example from MDN
#container {
  display: flex;
  justify-content: space-around;
  background-color: darkslateblue;
  padding: 20px;
}

#container > div {
  height: 100px;
  width: 100px;
  margin: 3px;
  border: 2px solid black;
}

#one {
  background-color: red;
}

#two {
  background-color: lavender;
}

#three {
  background-color: transparent;
}

Syntax

aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen | transparent

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <named-color>
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

<system-color>

Type Baseline: widely availablesince January 2018 Modern CSS: AccentColor and AccentColorText

Spec However, in forced colors mode, most colors on the page are forced into a restricted, user-chosen palette, see CSS Color Adjustment 1 § 5.2 Forced Colors Mode Color Palettes. The <system-color> keywords expose these user-chosen colors so that the rest of the page can integrate with this restricted palette.

MDN The <system-color> CSS data type usually reflects the default color choices used for the different parts of a web page.

Live preview Example from MDN
.button {
  border: 0;
  padding: 10px;
  box-shadow:
    -2px -2px 5px gray,
    2px 2px 5px gray;
}

@media (forced-colors: active) {
  .button {
    /* Use a border instead, since box-shadow
    is forced to 'none' in forced-colors mode */
    border: 2px ButtonBorder solid;
  }
}

Syntax

AccentColor | AccentColorText | ActiveText | ButtonBorder | ButtonFace | ButtonText | Canvas | CanvasText | Field | FieldText | GrayText | Highlight | HighlightText | LinkText | Mark | MarkText | SelectedItem | SelectedItemText | VisitedText | <deprecated-color>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting <system-color>
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.