hex2rgb

Converts hex color to rgb and calculates appropriate corresponding foreground.

yiq

Returns light when a color is dark and dark when a color is light (and a little more).