some color calculation stuff

I'm not sure it's worth keeping