pythonansi-escapeansi-colors

Is there a Term::ANSIScreen equivalent for Python?


Perl has the excellent module Term::ANSIScreen for doing all sorts of fancy cursor movement and terminal color control. I'd like to reimplement a program that's currently in Perl in Python instead, but the terminal ANSI colors are key to its function. Is anyone aware of an equivalent?


Solution

  • If you only need colors You may want to borrow the implementation from pygments. IMO it's much cleaner than the one from ActiveState

    http://dev.pocoo.org/hg/pygments-main/file/b2deea5b5030/pygments/console.py