colors.distances: add some tests, refactor locals a little bit.