I\'m writing various utilities, and I\'m really liking colorized text. Nothing fancy, just using escape sequences. I\'ve created a simple class that has a pprint(msg, color) fun
I don't believe that's possible and it's unlikely to be portable if it were. The best you can do is send sgr0 which resets all attributes to default (not previous). On xterms, sgr0 is Esc[m. If you want to reset the colors and not affect other attributes, send op which on xterms is Esc[39;49m.
These codes should not be hardcoded. You should use terminfo, termcap or [n]curses.