tui

Members

(static) A_ALTCHARSET :number

Source:
Default Value:
  • 4194304

Alternate character set

Type:
  • number

(static) A_ATTRIBUTES :number

Source:
Default Value:
  • 4294967040

Bitmask to extract attributes

Type:
  • number
Source:
Default Value:
  • 524288

Blinking

Type:
  • number

(static) A_BOLD :number

Source:
Default Value:
  • 2097152

Extra bright or bold

Type:
  • number

(static) A_CHARTEXT :number

Source:
Default Value:
  • 255

Bitmask to extract a character

Type:
  • number

(static) A_COLOR :number

Source:
Default Value:
  • 65280

Bitmask to extract a color (?)

Type:
  • number

(static) A_DIM :number

Source:
Default Value:
  • 1048576

Half bright

Type:
  • number

(static) A_HORIZONTAL :number

Source:
Default Value:
  • 33554432
Type:
  • number

(static) A_INVIS :number

Source:
Default Value:
  • 8388608

Invisible or blank mode

Type:
  • number

(static) A_LEFT :number

Source:
Default Value:
  • 67108864
Type:
  • number

(static) A_LOW :number

Source:
Default Value:
  • 134217728
Type:
  • number

(static) A_NORMAL :number

Source:

Normal display

Type:
  • number

(static) A_PROTECT :number

Source:
Default Value:
  • 16777216

Protected mode

Type:
  • number

(static) A_REVERSE :number

Source:
Default Value:
  • 262144

Reverse video

Type:
  • number

(static) A_RIGHT :number

Source:
Default Value:
  • 268435456
Type:
  • number

(static) A_STANDOUT :number

Source:
Default Value:
  • 65536

Best hightlighting mode of terminal

Type:
  • number

(static) A_TOP :number

Source:
Default Value:
  • 536870912
Type:
  • number

(static) A_UNDERLINE :number

Source:
Default Value:
  • 131072

Underlining

Type:
  • number

(static) A_VERTICAL :number

Source:
Default Value:
  • 1073741824
Type:
  • number

(static) can_change_color :boolean

Source:
Default Value:
  • undefined
Type:
  • boolean

(static) COLOR_BLACK :number

Source:
Type:
  • number

(static) COLOR_BLUE :number

Source:
Default Value:
  • 4
Type:
  • number

(static) COLOR_CYAN :number

Source:
Default Value:
  • 6
Type:
  • number

(static) COLOR_GREEN :number

Source:
Default Value:
  • 2
Type:
  • number

(static) COLOR_MAGENTA :number

Source:
Default Value:
  • 5
Type:
  • number

(static) COLOR_RED :number

Source:
Default Value:
  • 1
Type:
  • number

(static) COLOR_WHITE :number

Source:
Default Value:
  • 7
Type:
  • number

(static) COLOR_YELLOW :number

Source:
Default Value:
  • 3
Type:
  • number

(static) DEFAULT_BORDER :object

Source:
Default Value:
  • {"lt":"┌","t":"─","rt":"┐","r":"│","rb":"┘","b":"─","lb":"└","l":"│"}
Type:
  • object

(static) has_colors :boolean

Source:
Default Value:
  • undefined
Type:
  • boolean

(static) KEY_BACKSPACE :number

Source:
Default Value:
  • 263
Type:
  • number

(static) KEY_CTRL_A :number

Source:
Default Value:
  • 1
Type:
  • number

(static) KEY_CTRL_B :number

Source:
Default Value:
  • 2
Type:
  • number

(static) KEY_CTRL_C :number

Source:
Default Value:
  • 3
Type:
  • number

(static) KEY_CTRL_D :number

Source:
Default Value:
  • 4
Type:
  • number

(static) KEY_CTRL_E :number

Source:
Default Value:
  • 5
Type:
  • number

(static) KEY_CTRL_F :number

Source:
Default Value:
  • 6
Type:
  • number

(static) KEY_CTRL_G :number

Source:
Default Value:
  • 7
Type:
  • number

(static) KEY_CTRL_H :number

Source:
Default Value:
  • 8
Type:
  • number

(static) KEY_CTRL_K :number

Source:
Default Value:
  • 11
Type:
  • number

(static) KEY_CTRL_L :number

Source:
Default Value:
  • 12
Type:
  • number

(static) KEY_CTRL_M :number

Source:
Default Value:
  • 13
Type:
  • number

(static) KEY_CTRL_N :number

Source:
Default Value:
  • 14
Type:
  • number

(static) KEY_CTRL_O :number

Source:
Default Value:
  • 15
Type:
  • number

(static) KEY_CTRL_P :number

Source:
Default Value:
  • 16
Type:
  • number

(static) KEY_CTRL_Q :number

Source:
Default Value:
  • 17
Type:
  • number

(static) KEY_CTRL_R :number

Source:
Default Value:
  • 18
Type:
  • number

(static) KEY_CTRL_S :number

Source:
Default Value:
  • 19
Type:
  • number

(static) KEY_CTRL_T :number

Source:
Default Value:
  • 20
Type:
  • number

(static) KEY_CTRL_U :number

Source:
Default Value:
  • 21
Type:
  • number

(static) KEY_CTRL_V :number

Source:
Default Value:
  • 22
Type:
  • number

(static) KEY_CTRL_W :number

Source:
Default Value:
  • 23
Type:
  • number

(static) KEY_CTRL_X :number

Source:
Default Value:
  • 24
Type:
  • number

(static) KEY_CTRL_Y :number

Source:
Default Value:
  • 25
Type:
  • number

(static) KEY_CTRL_Z :number

Source:
Default Value:
  • 26
Type:
  • number

(static) KEY_DEL :number

Source:
Default Value:
  • 330
Type:
  • number

(static) KEY_DOWN :number

Source:
Default Value:
  • 258
Type:
  • number

(static) KEY_END :number

Source:
Default Value:
  • 360
Type:
  • number

(static) KEY_ENTER :number

Source:
Default Value:
  • 10
Type:
  • number

(static) KEY_ESC :number

Source:
Default Value:
  • 27
Type:
  • number

(static) KEY_F1 :number

Source:
Default Value:
  • 265
Type:
  • number

(static) KEY_F2 :number

Source:
Default Value:
  • 266
Type:
  • number

(static) KEY_F3 :number

Source:
Default Value:
  • 267
Type:
  • number

(static) KEY_F4 :number

Source:
Default Value:
  • 268
Type:
  • number

(static) KEY_F5 :number

Source:
Default Value:
  • 269
Type:
  • number

(static) KEY_F6 :number

Source:
Default Value:
  • 270
Type:
  • number

(static) KEY_F7 :number

Source:
Default Value:
  • 271
Type:
  • number

(static) KEY_F8 :number

Source:
Default Value:
  • 272
Type:
  • number

(static) KEY_F9 :number

Source:
Default Value:
  • 273
Type:
  • number

(static) KEY_F10 :number

Source:
Default Value:
  • 274
Type:
  • number

(static) KEY_F11 :number

Source:
Default Value:
  • 275
Type:
  • number

(static) KEY_F12 :number

Source:
Default Value:
  • 276
Type:
  • number

(static) KEY_HOME :number

Source:
Default Value:
  • 262
Type:
  • number

(static) KEY_INSERT :number

Source:
Default Value:
  • 331
Type:
  • number

(static) KEY_LEFT :number

Source:
Default Value:
  • 260
Type:
  • number

(static) KEY_NEXT_PAGE :number

Source:
Default Value:
  • 338
Type:
  • number

(static) KEY_NPAGE :number

Source:
Deprecated:
Default Value:
  • 338
Type:
  • number

(static) KEY_PPAGE :number

Source:
Deprecated:
Default Value:
  • 339
Type:
  • number

(static) KEY_PREV_PAGE :number

Source:
Default Value:
  • 339
Type:
  • number

(static) KEY_RESIZE :number

Source:
Default Value:
  • 410
Type:
  • number

(static) KEY_RIGHT :number

Source:
Default Value:
  • 261
Type:
  • number

(static) KEY_TAB :number

Source:
Default Value:
  • 9
Type:
  • number

(static) KEY_UP :number

Source:
Default Value:
  • 259
Type:
  • number

(static) max_color_pairs :number

Source:
Default Value:
  • undefined
Type:
  • number

(static) max_colors :number

Source:
Default Value:
  • undefined
Type:
  • number

(static) stdscr :Window

Source:
Default Value:
  • undefined

The default window, which represents the whole screen

Type:

Methods

(static) add_colors(definitions) → {object}

Source:
See:

Define multiple colors to be used by draw modes

Example
const colors = tui.add_colors({
  WHITE: 'fff',
  BLACK: '000',
  RED: 'ff0000',
});
Parameters:
Name Type Description
definitions object

An object containing properties where keys represent names and values are strings containing hex values for red, green and blue (as in CSS).

Returns:

An object with the same keys as the {definitions} param but values are replaced by color ids.

Type
object

(static) add_draw_modes(definitions) → {object}

Source:

Define multiple draw modes

Example
const modes = tui.add_draw_modes({
  DEFAULT: [tui.A_NORMAL, color.WHITE, color.BLACK],
  ERROR: [tui.A_BOLD, color.RED, color.BLACK],
});
Parameters:
Name Type Description
definitions object

An object containing properties where keys represent names and values are tuples (arrays) of [attrs, fg, bg].

Returns:

An object with the same keys as the {definitions} param but values are replaced by draw mode ids

Type
object

(static) clear(winopt) → {void}

Source:
See:

Erase whole window

Parameters:
Name Type Attributes Default Description
win Window <optional>
module:tui.stdscr
Returns:
Type
void

(static) curs_move(row, col) → {void}

Source:
Parameters:
Name Type Description
row number

Row coordinate (starts at 1)

col number

Column coordinate (starts at 1)

Returns:
Type
void

(static) curs_pos() → {WindowPos}

Source:

Get cursor position

Returns:
Type
WindowPos

(static) curs_set(visible) → {void}

Source:
Parameters:
Name Type Description
visible boolean
Returns:
Type
void

(static) end() → {void}

Source:
Returns:
Type
void

(static) get_draw_mode() → {DrawMode}

Source:
Returns:
Type
DrawMode

(static) get_key_name(key) → {string}

Source:

Get the human readable name of a key code

Parameters:
Name Type Description
key number
Returns:

Something like 'Ctrl-D', 'Space', or 'A'

Type
string

(static) get_size(winopt) → {WindowSize}

Source:

Get the size of a window, i.e., number or row and columns.

Parameters:
Name Type Attributes Default Description
win Window <optional>
module:tui.stdscr
Returns:

The window size

Type
WindowSize

(static) getch() → {int}

Source:
Returns:

A key code

Type
int

(static) init() → {void}

Source:
Returns:
Type
void

(static) print(winopt, row, col, …items) → {void}

Source:
Parameters:
Name Type Attributes Default Description
win Window <optional>
module:tui.stdscr
row number
col number
items * <repeatable>

Items to print

Returns:
Type
void

(static) refresh(winopt) → {void}

Source:
Parameters:
Name Type Attributes Default Description
win Window <optional>
module:tui.stdscr
Returns:
Type
void

(static) set_default_draw_mode(draw_mode)

Source:
See:

Set the colors used to clear the screen and draw borders

Parameters:
Name Type Description
draw_mode DrawMode

(static) set_draw_mode(mode) → {void}

Source:
Parameters:
Name Type Description
mode DrawMode
Returns:
Type
void

(static) timeout(delay)

Source:

Set the timeout (in milliseconds) for the module:tui.getch function.

Parameters:
Name Type Description
delay number | null

Number of milliseconds to wait for a key press before timeout. A delay of 0 configures getch() for non-blocking mode, whereas a value of null makes getch() block until a key is pressed.

(static) win_del(win) → {void}

Source:

Delete an existing {Window}

Parameters:
Name Type Description
win Window
Returns:
Type
void

(static) win_move(win) → {void}

Source:

Move an existing {Window}

Parameters:
Name Type Description
win Window
Returns:
Type
void

(static) win_new(row, col, rows, cols, borderopt) → {Window}

Source:

Create a new {Window} with given coordinates and size

Parameters:
Name Type Attributes Default Description
row number
col number
rows number
cols number
border WindowBorder | boolean <optional>
false

An explicit {WindowBorder} object, or {true} to use module:tui.DEFAULT_BORDER

Returns:
Type
Window