Convert between HEX and RGB color values.
HEX is six hexadecimal digits — two each for red, green, and blue, from 00 to FF. It is the standard notation in CSS and design tools, and it is simply RGB written compactly.
RGB gives the same three channels as decimal values from 0 to 255. It is easier to manipulate arithmetically, and it extends naturally to RGBA when transparency is needed.
HSL describes hue as an angle on the colour wheel, with saturation and lightness as percentages. It is far more intuitive for design work: to make a colour lighter you change one number, whereas in RGB you have to adjust all three in the right proportion.
The Web Content Accessibility Guidelines define a contrast ratio between text and background, running from 1:1 for identical colours to 21:1 for pure black on pure white.
Light grey text on a white background is the single most common accessibility failure on the web. It looks refined on a bright, high-quality monitor and becomes unreadable on a phone in sunlight or to anyone with reduced contrast sensitivity — which includes most people over sixty.
Start from one hue and vary lightness to produce a scale. Because HSL separates hue from lightness, you can generate a coherent set of tints and shades by holding hue and saturation constant and stepping lightness.
For accent colours, hues roughly 30 degrees apart read as related, 120 degrees apart as clearly distinct, and 180 degrees apart as complementary. Avoid relying on red and green alone to convey meaning: around one in twelve men has some form of colour vision deficiency, and red-green is by far the most common. Pair colour with shape, position, or a label so the information survives without it.