Converts red, green and blue values from 0 to 255 into a HEX colour code and its HSL equivalent. A HEX code writes each channel as two hexadecimal digits, as in #3B82F6.
This tool converts red, green and blue values from 0 to 255 into a HEX colour code and its HSL equivalent.
A colour code writes each channel as two hexadecimal digits and lists them red, green, blue. Each channel is eight bits, giving 256 levels, which is exactly what two hexadecimal digits hold: 0 to 255 in decimal is 00 to FF. Three channels together give 16.7 million colours.
HSL describes the same colour by hue, saturation and lightness. The hue is an angle from 0 to 360 degrees, with red at 0, green at 120 and blue at 240. When only the brightness is to change, or a family of related colours is wanted, HSL is the easier form to work in.
The luminance given alongside is the brightness of the colour as the eye judges it, running from 0 for black to 1 for white.
Here , and are the channels converted back to values proportional to the light emitted. Green carries much the largest coefficient because the eye finds green the brightest of the three.
Red 59, green 130 and blue 246 give the code #3B82F6. In HSL that is a hue of 217 degrees, saturation 91 per cent and lightness 60 per cent, with a relative luminance of 0.235.
In hexadecimal 59 is 3B, 130 is 82 and 246 is F6. A hue of 217 degrees sits between blue and cyan.
The figures here are sRGB. Other colour spaces, used in photography and printing, give a different colour for the same three numbers.
To judge whether text will be readable on a background, use the contrast ratio rather than the luminance on its own.