Skip to content

TerminalEscapeCodes

[Source]

These strings can be embedded in text when writing to a StdStream to create a text-based UI.

trait ref TerminalEscapeCodes

Public Functions

up

[Source]

Move the cursor up n lines. 0 is the same as 1.

fun box up(
  n: U32 val = 0)
: String val

Parameters

  • n: U32 val = 0

Returns


down

[Source]

Move the cursor down n lines. 0 is the same as 1.

fun box down(
  n: U32 val = 0)
: String val

Parameters

  • n: U32 val = 0

Returns


[Source]

Move the cursor right n columns. 0 is the same as 1.

fun box right(
  n: U32 val = 0)
: String val

Parameters

  • n: U32 val = 0

Returns


left

[Source]

Move the cursor left n columns. 0 is the same as 1.

fun box left(
  n: U32 val = 0)
: String val

Parameters

  • n: U32 val = 0

Returns


cursor

[Source]

Move the cursor to line y, column x. 0 is the same as 1. This indexes from the top left corner of the screen.

fun box cursor(
  x: U32 val = 0,
  y: U32 val = 0)
: String val

Parameters

  • x: U32 val = 0
  • y: U32 val = 0

Returns


clear

[Source]

Clear the screen and move the cursor to the top left corner.

fun box clear(
  how_much: (EraseBefore val | EraseAfter val | EraseAll val) = reference)
: String val

Parameters

Returns


erase

[Source]

Erases some or all of the line the cursor is on.

fun box erase(
  how_much: (EraseBefore val | EraseAfter val | EraseAll val) = reference)
: String val

Parameters

Returns


reset

[Source]

Resets all colours and text styles to the default.

fun box reset()
: String val

Returns


bold

[Source]

Bold text. Does nothing on Windows.

fun box bold(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


underline

[Source]

Underlined text. Does nothing on Windows.

fun box underline(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


[Source]

Blinking text. Does nothing on Windows.

fun box blink(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


reverse

[Source]

Swap foreground and background colour.

fun box reverse(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


black

[Source]

Black text.

fun box black()
: String val

Returns


red

[Source]

Red text.

fun box red()
: String val

Returns


green

[Source]

Green text.

fun box green()
: String val

Returns


yellow

[Source]

Yellow text.

fun box yellow()
: String val

Returns


blue

[Source]

Blue text.

fun box blue()
: String val

Returns


magenta

[Source]

Magenta text.

fun box magenta()
: String val

Returns


cyan

[Source]

Cyan text.

fun box cyan()
: String val

Returns


grey

[Source]

Grey text.

fun box grey()
: String val

Returns


white

[Source]

White text.

fun box white()
: String val

Returns


bright_red

[Source]

Bright red text.

fun box bright_red()
: String val

Returns


bright_green

[Source]

Bright green text.

fun box bright_green()
: String val

Returns


bright_yellow

[Source]

Bright yellow text.

fun box bright_yellow()
: String val

Returns


bright_blue

[Source]

Bright blue text.

fun box bright_blue()
: String val

Returns


bright_magenta

[Source]

Bright magenta text.

fun box bright_magenta()
: String val

Returns


bright_cyan

[Source]

Bright cyan text.

fun box bright_cyan()
: String val

Returns


bright_grey

[Source]

Bright grey text.

fun box bright_grey()
: String val

Returns


black_bg

[Source]

Black background.

fun box black_bg()
: String val

Returns


red_bg

[Source]

Red background.

fun box red_bg()
: String val

Returns


green_bg

[Source]

Green background.

fun box green_bg()
: String val

Returns


yellow_bg

[Source]

Yellow background.

fun box yellow_bg()
: String val

Returns


blue_bg

[Source]

Blue background.

fun box blue_bg()
: String val

Returns


magenta_bg

[Source]

Magenta background.

fun box magenta_bg()
: String val

Returns


cyan_bg

[Source]

Cyan background.

fun box cyan_bg()
: String val

Returns


grey_bg

[Source]

Grey background.

fun box grey_bg()
: String val

Returns


white_bg

[Source]

White background.

fun box white_bg()
: String val

Returns


bright_red_bg

[Source]

Bright red background.

fun box bright_red_bg()
: String val

Returns


bright_green_bg

[Source]

Bright green background.

fun box bright_green_bg()
: String val

Returns


bright_yellow_bg

[Source]

Bright yellow background.

fun box bright_yellow_bg()
: String val

Returns


bright_blue_bg

[Source]

Bright blue background.

fun box bright_blue_bg()
: String val

Returns


bright_magenta_bg

[Source]

Bright magenta background.

fun box bright_magenta_bg()
: String val

Returns


bright_cyan_bg

[Source]

Bright cyan background.

fun box bright_cyan_bg()
: String val

Returns


bright_grey_bg

[Source]

Bright grey background.

fun box bright_grey_bg()
: String val

Returns


cursor_save

[Source]

Save current cursor position

fun box cursor_save()
: String val

Returns


cursor_restore

[Source]

Restore last saved cursor position

fun box cursor_restore()
: String val

Returns


cursor_hide

[Source]

Hide the terminal cursor

fun box cursor_hide()
: String val

Returns


cursor_show

[Source]

Show the terminal cursor

fun box cursor_show()
: String val

Returns


switch_to_alt_screen

[Source]

Switch to the alternate screen buffer

fun box switch_to_alt_screen()
: String val

Returns


switch_to_normal_screen

[Source]

Switch back to the normal screen buffer

fun box switch_to_normal_screen()
: String val

Returns


mouse_enable

[Source]

Enable mouse input events

fun box mouse_enable()
: String val

Returns


mouse_disable

[Source]

Disable mouse input handling

fun box mouse_disable()
: String val

Returns


reset_color

[Source]

Resets foreground colour (but not the text styles)

fun box reset_color()
: String val

Returns


reset_color_bg

[Source]

Resets foreground colour (but not the text styles)

fun box reset_color_bg()
: String val

Returns


color

[Source]

Select an 8-bit foreground (text) color.

fun box color(
  fg: U8 val)
: String val

Parameters

  • fg: U8 val

Returns


color_bg

[Source]

Select an 8-bit background color.

fun box color_bg(
  bg: U8 val)
: String val

Parameters

  • bg: U8 val

Returns


faint

[Source]

Lighten (faint) text. May not work on Windows.

fun box faint(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


italics

[Source]

Italicize text. May not work on Windows.

fun box italics(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


invert

[Source]

Invert foreground/background colour. May not work on Windows.

fun box invert(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


conceal

[Source]

Conceal (hide) the text. May not work on Windows.

fun box conceal(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


strikeout

[Source]

Strike through text. May not work on Windows.

fun box strikeout(
  state: Bool val = true)
: String val

Parameters

  • state: Bool val = true

Returns


repeat_char

[Source]

fun box repeat_char(
  char: String val,
  times: U32 val)
: String val

Parameters

Returns