Learn to calculate by playing with HEX, RGB and HSL colour converter
A short game to see where the result comes from. Pick a language and start; you can stop halfway and come back.
Loading the game…
← Back to HEX, RGB and HSL colour converter
What you will practise
Convert between colour formats and check contrast against white.
How it works
The colour is read in any of the three formats and converted to the other two. Relative luminance follows the formula from the WCAG accessibility guidelines.
Formula
Luminance = 0.2126·R + 0.7152·G + 0.0722·B (linearised)
Contrast = (L1 + 0.05) ÷ (L2 + 0.05)
Worked example
The colour #2563eb is equivalent to:
rgb(37, 99, 235)
hsl(221, 83%, 53%)
Contrast against white: 5.17:1
How to play
First pick your language. Then work through the challenges one by one: each sets out a case with real numbers and, if you get stuck, you can ask for a hint. When you answer, you see whether you got it right and why. Progress is saved only in your browser, so you can stop halfway and carry on another day.