Developer_release_1.4.0

Class lua-repl.lib.ansi

ANSI utilities.

Fields

ansi.bg_black Black background color ANSI sequence ('\x1b[40m').
ansi.bg_blue Blue background color ANSI sequence ('\x1b[44m').
ansi.bg_cyan Cyan background color ANSI sequence ('\x1b[46m').
ansi.bg_green Green background color ANSI sequence ('\x1b[42m').
ansi.bg_magenta Magenta background color ANSI sequence ('\x1b[45m').
ansi.bg_red Red background color ANSI sequence ('\x1b[41m').
ansi.bg_white White background color ANSI sequence ('\x1b[47m').
ansi.bg_yellow Yellow background color ANSI sequence ('\x1b[43m').
ansi.blue Blue foreground color ANSI sequence ('\x1b[30;34m').
ansi.clear_screen Clear screen ANSI sequence ('\x1b[2J').
ansi.clear_to_end_of_line Clear to end of line ANSI sequence ('\x1b[K').
ansi.cyan Cyan foreground color ANSI sequence ('\x1b[30;36m').
ansi.gray Gray foreground color ANSI sequence ('\x1b[30;90m').
ansi.green Green foreground color ANSI sequence ('\x1b[30;32m').
ansi.hide_cursor Hide cursor ANSI sequence ('\x1b[?25l').
ansi.light_blue Light blue foreground color ANSI sequence ('\x1b[30;94m').
ansi.light_cyan Light cyan foreground color ANSI sequence ('\x1b[30;96m').
ansi.light_green Light green foreground color ANSI sequence ('\x1b[30;92m').
ansi.light_magenta Light magenta foreground color ANSI sequence.
ansi.light_red Light red foreground color ANSI sequence ('\x1b[30;91m').
ansi.light_yellow Light yellow foreground color ANSI sequence ('\x1b[30;93m').
ansi.magenta Magenta foreground color ANSI sequence ('\x1b[30;35m').
ansi.red Red foreground color ANSI sequence ('\x1b[30;31m').
ansi.report_cursor_position Report cursor position ANSI sequence ('\x1b[6n').
ansi.reset_color Reset color ANSI sequence ('\x1b[0m').
ansi.restore_cursor_position Restore cursor position ANSI sequence ('\x1b[u').
ansi.save_cursor_position Save cursor position ANSI sequence ('\x1b[s').
ansi.show_cursor Show cursor ANSI sequence ('x1b[?25h').
ansi.white White foreground color ANSI sequence ('\x1b[30;97m').
ansi.yellow Yellow foreground color ANSI sequence ('\x1b[30;33m').

Methods

ansi:color (str_or_x[, y=nil]) Returns set color ANSI sequence.
ansi:cursor_down (lines) Returns move cursor position down ANSI sequence.
ansi:cursor_left (chars) Returns move cursor position left ANSI sequence.
ansi:cursor_position (x, y) Returns set cursor position ANSI sequence.
ansi:cursor_right (chars) Returns move cursor position right ANSI sequence.
ansi:cursor_up (lines) Returns move cursor position up ANSI sequence.
ansi:disable_all () Disable all codes.
ansi:disable_colors () Disable all color codes.
lua-repl.lib.ansi.new () Create new ANSI provider instance.
ansi:restore_all () Restore all disabled codes.


Fields

ansi.bg_black
Black background color ANSI sequence ('\x1b[40m').
ansi.bg_blue
Blue background color ANSI sequence ('\x1b[44m').
ansi.bg_cyan
Cyan background color ANSI sequence ('\x1b[46m').
ansi.bg_green
Green background color ANSI sequence ('\x1b[42m').
ansi.bg_magenta
Magenta background color ANSI sequence ('\x1b[45m').
ansi.bg_red
Red background color ANSI sequence ('\x1b[41m').
ansi.bg_white
White background color ANSI sequence ('\x1b[47m').
ansi.bg_yellow
Yellow background color ANSI sequence ('\x1b[43m').
ansi.blue
Blue foreground color ANSI sequence ('\x1b[30;34m').
ansi.clear_screen
Clear screen ANSI sequence ('\x1b[2J').
ansi.clear_to_end_of_line
Clear to end of line ANSI sequence ('\x1b[K').
ansi.cyan
Cyan foreground color ANSI sequence ('\x1b[30;36m').
ansi.gray
Gray foreground color ANSI sequence ('\x1b[30;90m').
ansi.green
Green foreground color ANSI sequence ('\x1b[30;32m').
ansi.hide_cursor
Hide cursor ANSI sequence ('\x1b[?25l').
ansi.light_blue
Light blue foreground color ANSI sequence ('\x1b[30;94m').
ansi.light_cyan
Light cyan foreground color ANSI sequence ('\x1b[30;96m').
ansi.light_green
Light green foreground color ANSI sequence ('\x1b[30;92m').
ansi.light_magenta
Light magenta foreground color ANSI sequence. ('\x1b[30;95m')
ansi.light_red
Light red foreground color ANSI sequence ('\x1b[30;91m').
ansi.light_yellow
Light yellow foreground color ANSI sequence ('\x1b[30;93m').
ansi.magenta
Magenta foreground color ANSI sequence ('\x1b[30;35m').
ansi.red
Red foreground color ANSI sequence ('\x1b[30;31m').
ansi.report_cursor_position
Report cursor position ANSI sequence ('\x1b[6n').
ansi.reset_color
Reset color ANSI sequence ('\x1b[0m').
ansi.restore_cursor_position
Restore cursor position ANSI sequence ('\x1b[u').
ansi.save_cursor_position
Save cursor position ANSI sequence ('\x1b[s').
ansi.show_cursor
Show cursor ANSI sequence ('x1b[?25h').
ansi.white
White foreground color ANSI sequence ('\x1b[30;97m').
ansi.yellow
Yellow foreground color ANSI sequence ('\x1b[30;33m').

Methods

ansi:color (str_or_x[, y=nil])
Returns set color ANSI sequence.

Parameters:

  • str_or_x string or integer Color ID string or first numeric argument
  • y integer Second numeric argument (default nil)

Returns:

    string Set color ANSI sequence
ansi:cursor_down (lines)
Returns move cursor position down ANSI sequence.

Parameters:

  • lines integer Lines count

Returns:

    string Move cursor position down ANSI sequence
ansi:cursor_left (chars)
Returns move cursor position left ANSI sequence.

Parameters:

  • chars integer Characters count

Returns:

    string Move cursor position left ANSI sequence
ansi:cursor_position (x, y)
Returns set cursor position ANSI sequence.

Parameters:

  • x integer X coordinate on the screen
  • y integer Y coordinate on the screen

Returns:

    string Set cursor position ANSI sequence
ansi:cursor_right (chars)
Returns move cursor position right ANSI sequence.

Parameters:

  • chars integer Characters count

Returns:

    string Move cursor position right ANSI sequence
ansi:cursor_up (lines)
Returns move cursor position up ANSI sequence.

Parameters:

  • lines integer Lines count

Returns:

    string Move cursor position up ANSI sequence
ansi:disable_all ()
Disable all codes.
ansi:disable_colors ()
Disable all color codes.
lua-repl.lib.ansi.new ()
Create new ANSI provider instance.

Usage:

    ansi = (require 'lua-repl.lib.ansi').new()
ansi:restore_all ()
Restore all disabled codes.
generated by LDoc 1.4.6 Last updated 1980-01-01 00:00:00