Refactored some colour based functions.

Moved them out into their own file.