Colour similarity
holBrightness difference
Contrast

Example of selected colours for text and background:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum dapibus metus vitae augue. Nam purus leo, lobortis sit amet, fringilla in, euismod condimentum, nunc.

#
#