HEX, RGB, HSL and OKLCH: what the color codes mean
Open the details of any swatch in Image Color Palette and you see the same color written four ways. They are not four different colors; they are four notations for one. Knowing what each code means makes it easier to choose the right one for a stylesheet, a design file or a note to a decorator.
RGB: the screen’s own recipe
Screens build every color from red, green and blue light. RGB writes a color as three numbers, each from 0 to 255: how much red, how much green, how much blue. rgb(214, 179, 140) is a warm sand tone; rgb(0, 0, 0) is black and rgb(255, 255, 255) is white. RGB is direct and precise, but it is hard to guess what a set of numbers looks like, or how to make it a little lighter, just by reading it.
HEX: RGB in short form
A HEX code is the same three RGB values written in base 16, two characters each, after a #. The sand tone above becomes #D6B38C: D6 is 214, B3 is 179, 8C is 140. Converting is mechanical in both directions, so nothing is lost on the way. HEX is compact, easy to paste and understood almost everywhere colors are typed, which is why the palette shows it on every swatch and copies it when you tap one.
HSL: closer to how people describe color
HSL describes a color by hue (its position on the color wheel, in degrees), saturation (how strong it is) and lightness (from black to white). The sand tone is roughly hsl(32, 47%, 69%). Want a darker version? Lower the lightness and keep the rest. That makes HSL handy for quick adjustments and for building lighter and darker steps of one color.
Its weakness is that HSL lightness is a mathematical value, not a perceived one. A yellow and a blue with the same HSL lightness look very different in brightness: the yellow seems far lighter to the eye.
OKLCH: lightness you can trust
OKLCH is a newer notation built on a model of human vision. L is perceived lightness, C is chroma (colorfulness) and H is hue. Because L follows what people actually see, two colors with the same L look about equally light, whatever their hue. That helps when you want buttons in different hues that feel equally strong, or when you need text to stay readable against a background. Current browsers accept OKLCH directly in CSS.
Which one to use
- HEX to share, store or paste a color quickly; it is the most widely accepted.
- RGB when a program asks for separate channel numbers.
- HSL for small tweaks of one color, such as a slightly lighter hover state.
- OKLCH when you build color scales or compare colors and want lightness to behave consistently.
All four values in Image Color Palette describe the same color in sRGB, the standard color space of the web, so switching between them does not shift the color. Open a swatch’s details to copy the code you need, or use Copy all HEX or Copy CSS variables to take the whole palette at once.
Get a color palette from your image → Image Color Palette