HSL and HSLA Colors
The hsl() function defines colors using Hue, Saturation, and Lightness — a model that more closely mirrors human perception than RGB. Hue is an angle on the color wheel (0–360°): 0° is red, 120° is green, 240° is blue. Saturation is a percentage: 100% is fully saturated, 0% is grey. Lightness is also a percentage: 0% is black, 50% is the pure color, 100% is white.
Why HSL is Powerful for Design
HSL makes it easy to create color variations by adjusting only one value. Increase lightness for a tint, decrease it for a shade, reduce saturation for a more neutral tone — all while keeping the same hue. hsla() adds an alpha channel, just like rgba(). The modern hsl(h s% l% / a) syntax also works in all current browsers.