coderef

HSLBaseline · Widely available

The hsl() and hsla() CSS functions pick colors using hue, saturation, lightness, and alpha (transparency) channels.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.

Browser support

DesktopChrome
1–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–51Not supported
52+Supportedsince Mar 7, 2017
Current: 157
Safari
1–12Not supported
12.1+Supportedsince Mar 25, 2019
Current: 27
MobileChrome Android
18–64Not supported
65+Supportedsince Mar 6, 2018
Current: 155
Firefox Android
4–51Not supported
52+Supportedsince Mar 7, 2017
Current: 157
Safari iOS
1–12Not supported
12.2+Supportedsince Mar 25, 2019
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: hsl.

Feature detection

CSS · check before using
@supports (color: color(display-p3 1 0 0)) {
  /* styles that use hsl */
}

/* or in JavaScript */
if (CSS.supports("color", "color(display-p3 1 0 0)")) {
  // use it
}

Sub-features

Support for each part of the feature (4). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
<color>.hsl11213.11842
<color>.hsl.alpha_parameter65795212.1655212.2
<color>.hsl.mixed_type_parameters1211211221812112218
<color>.hsl.space_separated_parameters65795212.1655212.2