Replace the color codes these regexes: /.\{-}/ This is needed for portability since, when using tmux, the output is not colorized. Also, Im not sure that different terminals will use the same codes for the colors - but Im no expert.