XTerm control-sequence strings — selkie.pyx.xterm

Examples

The functions red() and green() set the foreground color for their argument:

>>> from selkie.pyx.xterm import red, green, repln
>>> print(red('hi'), green('bye'))

The function repln() causes its argument to replace the contents of the current line. It does a carriage return and line kill:

>>> print('hi there')
>>> print(repln('bye'))

Alternatively:

>>> print(repln(), 'bye')

Module Documentation

Functions for generating xterm control strings.

selkie.pyx.xterm.fg

Dict mapping color names to escape strings for foreground colors.

selkie.pyx.xterm.bg

Dict mapping color names to escape strings for background colors.

selkie.pyx.xterm.black(s)

Returns a string that displays the contents in black.

selkie.pyx.xterm.red(s)

Returns a string that displays the contents in red.

selkie.pyx.xterm.green(s)

Returns a string that displays the contents in green.

selkie.pyx.xterm.yellow(s)

Returns a string that displays the contents in yellow.

selkie.pyx.xterm.blue(s)

Returns a string that displays the contents in blue.

selkie.pyx.xterm.magenta(s)

Returns a string that displays the contents in magenta.

selkie.pyx.xterm.cyan(s)

Returns a string that displays the contents in cyan.

selkie.pyx.xterm.white(s)

Returns a string that displays the contents in white.

selkie.pyx.xterm.cursor_right(n=1)

An escape string that moves the cursor n spaces to the right.

selkie.pyx.xterm.cursor_left(n=1)

An escape string that moves the cursor n spaces to the left.

selkie.pyx.xterm.goto_column(n)

An escape string that moves the cursor to column n.