rewrote contrasted utility to not rely on a lightness threshold. Intstea...

...d it caluclates brightness of the color and compares to the given background color.

This pull request is for issue #1051.