Refactor out lambda functions for coloring output

These two functions are usefull in other contexts. Namely, coloring
SSH output.