picop.cyansi#

ANSI SGR escape sequences for terminals.

class picop.cyansi.BACKGROUND_COLORS_8#

Bases: object

Standard 8-color ANSI background escape sequences (SGR 40–47).

BLACK = '\x1b[40m'#
BLUE = '\x1b[44m'#
CYAN = '\x1b[46m'#
GREEN = '\x1b[42m'#
MAGENTA = '\x1b[45m'#
RED = '\x1b[41m'#
WHITE = '\x1b[47m'#
YELLOW = '\x1b[43m'#
class picop.cyansi.BOLD_COLORS_256#

Bases: object

Bold foreground color variants.

RED = '\x1b[31;1m'#
class picop.cyansi.FOREGROUND_COLORS_256#

Bases: object

Selected 256-color ANSI foreground sequences (SGR 38;5;n).

BLUE_DEFAULT = '\x1b[38;5;39m'#
BLUE_ULTRAMARINE = '\x1b[38;5;33m'#
GREEN_JUNGLE = '\x1b[38;5;79m'#
GREY = '\x1b[38;21m'#
ORANGE = '\x1b[38;5;208m'#
RED = '\x1b[38;5;196m'#
YELLOW = '\x1b[38;5;226m'#
class picop.cyansi.FOREGROUND_COLORS_8#

Bases: object

Standard 8-color ANSI foreground escape sequences (SGR 30–37).

BLACK = '\x1b[30m'#
BLUE = '\x1b[34m'#
CYAN = '\x1b[36m'#
GREEN = '\x1b[32m'#
MAGENTA = '\x1b[35m'#
RED = '\x1b[31m'#
WHITE = '\x1b[37m'#
YELLOW = '\x1b[33m'#
picop.cyansi.ansi_bg8(code)#

Return an 8-color background SGR for code.

Notes

Table hit for codes 4047.

Parameters:

code (int)

Return type:

str

picop.cyansi.ansi_bold(on=True)#

Return bold-on SGR, or reset when on is false. :type on: bool, default: True :param on:

Return type:

str

picop.cyansi.ansi_fg8(code)#

Return an 8-color foreground SGR for code.

Notes

Table hit for codes 3037.

Parameters:

code (int)

Return type:

str

picop.cyansi.ansi_fg256(n)#

Return a 256-color foreground SGR for palette index n.

Notes

Table lookup for indices 0255.

Parameters:

n (int)

Return type:

str

picop.cyansi.ansi_reset()#

Return the interned ANSI reset SGR sequence.

Return type:

str

picop.cyansi.ansi_strip(s)#

Remove CSI sequences from s in a single pass.

Notes

Returns s unchanged when no CSI sequences are present.

Parameters:

s (str)

Return type:

str

picop.cyansi.ansi_wrap(prefix, text, suffix=None)#

Return prefix + text + suffix.

Notes

Default suffix is the ANSI reset sequence.

Parameters:
Return type:

str