Better way to compute colors.
First version fully functional.