tezvyn:

HSL and HSV: Intuitive Ways to Represent RGB Color

AI-drafted, machine-checkedSource: Wikipedia: HSL and HSVintermediate
HSL and HSV: Intuitive Ways to Represent RGB Color

HSL and HSV are not new colors, but new ways to organize RGB. Think of them as cylindrical coordinates for color, making it easier for humans to select shades. You see them in every color picker.

WHY IT EXISTS The RGB color model, based on red, green, and blue light, is perfect for computer screens but unintuitive for humans. It's hard to guess the RGB values for 'light brown' or to make a given color 'slightly more vibrant'. HSL and HSV were developed to represent the RGB color space in a way that aligns better with how people perceive color attributes like hue, shade, and tone.

THE MENTAL MODEL Think of RGB as a cube, with red, green, and blue axes. HSL and HSV rearrange this cube into a cylinder. Hue is the angle around the cylinder (e.g., 0° is red, 120° is green, 240° is blue). Saturation is the distance from the center axis (0 saturation is grayscale). The vertical axis is either Lightness (HSL) or Value (HSV), representing brightness.

HOW IT WORKS Both HSL and HSV are mathematical transformations of RGB values. Hue is calculated based on which of R, G, or B is dominant. Saturation is determined by the difference between the maximum and minimum RGB components. The key difference is the third component. In HSV (Hue, Saturation, Value), Value is simply the largest of the R, G, or B components. In HSL (Hue, Saturation, Lightness), Lightness is the average of the largest and smallest RGB components. This makes HSL more symmetrical to light and dark, while HSV is often seen as a cone with black at the bottom point.

WHEN TO USE IT Use HSL or HSV for user-facing interfaces where a human needs to select or manipulate color. They are standard in color pickers, graphics applications, and image editing software. Operations like 'increase saturation' or 'decrease brightness' become simple adjustments to a single value, which is far more intuitive than trying to manipulate three RGB values simultaneously.

WHEN NOT TO USE IT Avoid HSL and HSV for most image analysis and computer vision tasks. They are not perceptually uniform, meaning a change of 10 units in hue or saturation does not correspond to the same amount of visual change across the color space. This makes calculating the 'distance' or difference between two colors unreliable. They are rearrangements of RGB designed for human convenience, not for robust algorithmic analysis.

ONE CANONICAL EXAMPLE The modern color picker is the canonical example. A user first selects a pure color from a Hue slider, which is often a rainbow-like strip representing the 360° of the cylinder. Then, they refine their choice in a 2D box. This box maps Saturation on one axis (from gray to the pure hue) and Value/Lightness on the other (from black to white/color), allowing for intuitive selection of millions of colors.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.