
A cylindrical-coordinate representation of colors, HSL is designed to be perceptually intuitive, mimicking how humans actually describe color. Unlike the RGB model, which is based on how hardware mixes light, HSL focuses on three components: Hue, Saturation, and Lightness.
The Three Components of HSL
- Hue (H): The type of color or its position on the color wheel. Represented in degrees from 0° to 360°, with 0° / 360° being Red, 120° Green, and 240° Blue. Changing the Hue cycles you through the rainbow.
- Saturation (S): The intensity or purity of the color. Represented as a percentage from 0% to 100%, with 0% being grayscale and 100% being full, vibrant color. Lowering saturation washes out the color toward gray.
- Lightness (L): The amount of white or black mixed into the color. Represented as a percentage from 0% to 100%, with 0% being absolute black, 50% being the pure version of the color (at 100% Saturation), and 100% being absolute white. Increasing lightness moves the color toward white; decreasing it moves it toward black.
HSL vs. HSLA
HSLA is the same model with an added Alpha (A) channel. This controls Transparency (Opacity), usually measured from 0.0 (fully transparent) to 1.0 (fully opaque).
- Format: HSL(h, s, l) or HSLA(h, s, l, a)
- Syntax Example: HSL(200, 100%, 50%) or HSLA(200, 100%, 50%, 0.5)
Why Use HSL?
- Readability: It is much easier to identify a color from `hsl(0, 100%, 50%)` (Red) than from HEX code `#FF0000`.
- Color Palettes: To create a cohesive palette, keep the Hue the same and adjust Lightness to create shadows and highlights.
- Programmatic Control: In web development (CSS), HSL makes it trivial to calculate hover states (e.g., take the base color and decrease Lightness by 10%).