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.
A <hue> can be either an <angle> or a <number>.
<angle>An angle expressed in degrees, gradians, radians, or turns using the deg, grad, rad, or turn, respectively.
<number>A real number, representing degrees of the hue angle.
As an <angle> is periodic, <hue> is normalized to the range [0deg, 360deg). It implicitly wraps around such that 480deg is the same as 120deg, -120deg is the same as 240deg, -1turn is the same as 1turn, and so on.
The color wheel above shows hues at all angles in the sRGB color space. In particular, red is at 0deg, yellow is at 60deg, lime is at 120deg, cyan is at 180deg, blue is at 240deg, and magenta is at 300deg.
The angles corresponding to particular hues differ depending on the color space. For example, the hue angle of sRGB green is 120deg in the sRGB color space, but 134.39deg in the CIELAB color space.
The following table lists typical colors at various angles in the sRGB (used by hsl() and hwb()), CIELAB (used by lch()), and Oklab (used by oklch()) color spaces:
| 0° | 60° | 120° | 180° | 240° | 300° | |
|---|---|---|---|---|---|---|
| sRGB | ||||||
| CIELAB | ||||||
| Oklab |
<hue> values<hue> values are interpolated as <angle> values, and the default interpolation algorithm is shorter. In some color-related CSS functions, this can be overridden by the <hue-interpolation-method> component.
<hue> =
<number> |
<angle>
The following example shows the effect of changing the hue value of the hsl() functional notation on a color.
<input type="range" min="0" max="360" value="0" id="hue-slider" /> <p>Hue: <span id="hue-value">0deg</span></p> <div id="box"></div>
#box {
background-color: hsl(0 100% 50%);
}
const hue = document.querySelector("#hue-slider");
const box = document.querySelector("#box");
hue.addEventListener("input", () => {
box.style.backgroundColor = `hsl(${hue.value} 100% 50%)`;
document.querySelector("#hue-value").textContent = `${hue.value}deg`;
});
The following example shows a similar red color in different color spaces. The values in the lch() and oklch() functions are rounded for readability.
<div data-color="hsl-red">hsl()</div> <div data-color="hwb-red">hwb()</div> <div data-color="lch-red">lch()</div> <div data-color="oklch-red">oklch()</div>
[data-color="hsl-red"] {
/* hsl(<hue> <saturation> <lightness>) */
background-color: hsl(0 100% 50%);
}
[data-color="hwb-red"] {
/* hwb(<hue> <whiteness> <blackness>) */
background-color: hwb(0 0% 0%);
}
[data-color="lch-red"] {
/* lch(<lightness> <chroma> <hue>) */
background-color: lch(50 150 40);
}
[data-color="oklch-red"] {
/* oklch(<lightness> <chroma> <hue>) */
background-color: oklch(0.6 0.4 20);
}
| Specification |
|---|
| CSS Color Module Level 4> # typedef-hue> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hue |
1 | 12 | 1 | 9.5 | 3.1 | 18 | 4 | 10.1 | 2 | 1.0 | 4.4 | 2 |
alpha_parameter |
65 | 79 | 52 | 52 | 12.1 | 65 | 52 | 47 | 12.2 | 9.0 | 65 | 12.2 |
mixed_type_parameters |
121 | 121 | 122 | 107 | 18 | 121 | 122 | 81 | 18 | 25.0 | 121 | 18 |
relative_syntax |
125119–125s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
125119–125s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
128 | 111105–111s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for s and l). |
125119–125s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
128 | 8379–83s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for s and l). |
27.025.0–27.0s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
125119–125s and l channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require s and l values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for s and l). |
space_separated_parameters |
65 | 79 | 52 | 52 | 12.1 | 65 | 52 | 47 | 12.2 | 9.0 | 65 | 12.2 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hue |
101 | 101 | 96 | 87 | 15 | 101 | 96 | 70 | 15 | 19.0 | 101 | 15 |
mixed_type_parameters |
121 | 121 | 122 | 107 | 18 | 121 | 122 | 81 | 18 | 25.0 | 121 | 18 |
relative_syntax |
125119–125w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
125119–125w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
128 | 111105–111w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for w and b). |
125119–125w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
128 | 8379–83w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for w and b). |
27.025.0–27.0w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
125119–125w and b channel values incorrectly resolve to numbers between 0-1 rather than 0-100. As a result, channel value calculations require w and b values to be specified as decimal percentage equivalents (e.g. 0.2 for 20%). See bug 330096624. |
1816.4–18Implementation based on older spec version. As a result, calculations with channel values do not work correctly, requiring values to be specified with units (deg for h, % for w and b). |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hue |
111 | 111 | 113 | 97 | 15 | 111 | 113 | 75 | 15 | 22.0 | 111 | 15 |
mixed_type_parameters |
116 | 116 | 113 | 102 | 16.2 | 116 | 113 | 78 | 16.2 | 24.0 | 116 | 16.2 |
relative_syntax |
119 | 119 | 128 | 105 | 1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
119 | 128 | 79 | 1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
25.0 | 119 | 1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hue |
111 | 111 | 113 | 97 | 15.4 | 111 | 113 | 75 | 15.4 | 22.0 | 111 | 15.4 |
mixed_type_parameters |
116 | 116 | 113 | 102 | 16.2 | 116 | 113 | 78 | 16.2 | 24.0 | 116 | 16.2 |
relative_syntax |
122119–122l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
122119–122l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
128 | 108105–108l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
122119–122l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
128 | 8179–81l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
26.025.0–26.0l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
122119–122l channel values incorrectly resolve to numbers between 0-100 rather than 0-1. As a result, channel value calculations require l values to be specified as percentage numbers without units (e.g. 20 for 0.2). See bug 40940488. |
1816.4–18Implementation based on older spec version. As a result, calculations withh channel values do not work correctly, requiring values to be specified with units (deg). |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/hue