ANSI Escape-code parser
New in version 0.5.5.
Find directives on class
Returns list of
New in version 0.9.0.
Parameters: text (str) – String containing directives. Return type: list
Given a string of characters, for each normal ASCII character, yields a directive consisting of a ‘putch’ instruction followed by the character itself.
If a valid ANSI escape sequence is detected within the string, the supported codes are translated into directives. For example
\033[42mwould emit a directive of
Note that unrecognised escape sequences are silently ignored: Only reset, reverse colours and 8 foreground and background colours are supported.
It is up to the consumer to interpret the directives and update its state accordingly.
Parameters: text (str) – An ASCII string which may or may not include valid ANSI Color escape codes.