refactor colorizing of text