Calculate relative luminance
Calculation of the relative luminance to determine if the text color to the background color matches
The relative luminance is an indicator of the contrast ratio. Only if the contrast between the font color and the background color is large enough, then the text even in difficult light conditions can be well read. So, for example, Web master and designer on a barrier-free Web design should pay attention.
WCAG defined: The Visual representation of text or images should be at least a contrast ratio of
4.5 : 1 (Level AA) or
7 : 1 (Level AAA) have.
Large scaled text should at least have a contrast ratio of
3 : 1 have