Skip to main content

Module ansi

Module ansi 

Source
Expand description

ANSI decoding utilities (Python Rich rich.ansi parity).

Python Rich supports decoding terminal output containing ANSI escape sequences into structured Text with styles. This module implements the subset required for parity with Rich 13.9.4:

  • SGR (ESC[...m) for attributes and colors
  • OSC 8 hyperlinks (ESC]8;...;urlESC\\) to set/clear links

The implementation is intentionally lenient: invalid / incomplete sequences are ignored.

Structsยง

AnsiDecoder
Stateful ANSI decoder (Python Rich rich.ansi.AnsiDecoder parity).