How to Pick Colours for Your Website With a Colour Picker

Guides

One colour, three names

Every colour on a screen can be described in three different ways: HEX, RGB and HSL. They all describe the same colour, and a colour picker gives you all three at once, so you can use whichever format your tool asks for.

Take a fresh green like #4ADE80. As RGB it is rgb(74, 222, 128). As HSL it is hsl(142, 69%, 58%). Same colour, three notations, and you can paste any of them into a stylesheet and get the same result.

What is a HEX code?

A HEX code is six hexadecimal digits after a # sign: two for red, two for green and two for blue. #FF0000 is pure red, #00FF00 is pure green, #0000FF is pure blue and #FFFFFF is white. HEX codes work in almost every design tool and website stylesheet: paste the code starting with # wherever a colour is asked for.

A three-digit shorthand also exists: #F00 means the same as #FF0000. It is handy for typing, but the six-digit form is clearer when you share colours with someone else.

RGB and HSL, explained

RGB mixes red, green and blue light, which is how screens work. Each value runs from 0 to 255, so rgb(74, 222, 128) is mostly green light, a fair amount of blue, and a little red.

HSL describes the same colour as a hue on a colour wheel plus saturation and lightness, which matches how people think about colour. The hue is an angle from 0 to 360 degrees: 0 is red, 120 is green, 240 is blue. Saturation is how vivid the colour is, and lightness is how bright. HSL is the easiest format for making variations: keep the hue and change the lightness to get lighter and darker shades of the same colour.

Picking colours that work together

A colour picker gives you the values; choosing well is a separate skill. A few rules help. First, check contrast: text needs enough contrast against its background to be readable, and the usual target is a contrast ratio of at least 4.5 to 1 for normal text. Second, use fewer colours: one main colour, one accent and one neutral will look more deliberate than five competing colours. Third, test your colours on a real phone screen, not just a large monitor — colours look different in bright daylight.

How to use the values in CSS

Any of the three formats works in a stylesheet:

color: #4ADE80;
color: rgb(74, 222, 128);
color: hsl(142, 69%, 58%);

They all produce the same colour. HEX is the shortest to type, RGB is the clearest when you need transparency (rgba adds a fourth value), and HSL is the best when you want to build a set of related shades.

Pick your colour

You can pick any colour in seconds with the free Colour Picker: choose with the picker or type a HEX code, and it shows the HEX, RGB and HSL values, ready to copy. Nothing is uploaded or stored.

Want to see the colour in a real page? The HTML Preview tool renders your HTML and CSS live in your browser.