How it works
HEX and RGB describe the same red, green and blue channels (0–255), in hexadecimal or decimal. HSL describes the colour as hue (0–360°), saturation and lightness, which makes it easier to create lighter or darker shades.
Contrast ratio follows the WCAG 2 formula using relative luminance. WCAG AA asks for at least 4.5:1 for normal text and 3:1 for large text.
Contrast = (L_lighter + 0.05) / (L_darker + 0.05)
L = 0.2126 R + 0.7152 G + 0.0722 B (linearised sRGB)Worked example
CrimsonEdge red #DC2626 is rgb(220, 38, 38) and hsl(0, 72%, 51%). White text on it has a contrast ratio of 4.83:1, which passes WCAG AA for normal text.