logoalt Hacker News

blululu • today at 2:48 PM • 0 replies • view on HN

There are plenty of comprehensive guides [1], but the basic procedure is to calculate the luminance of an RGB color value (gamma corrected) and then take the ratio with the following formula:

C = (L1 + 0.05) / (L2 + 0.05)

We can get into where the model breaks (the maximum contrast ratio of text on a computer is not 21), but it should be though of in the context of the fact that a website is seen on a great variety of displays of variable quality. If the contrast ratio is close to the line it is probably over the line for someone. You should aim to be inclusive and considerate and choose a contrast ratio that is likely to be legible for the majority of viewers.

https://www.accessibility-developer-guide.com/knowledge/colo...