Calculate the contrast ratio of text and background colors.