Skip to content

ANSI

[Source]

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

primitive val ANSI

Constructors

create

[Source]

new val create()
: ANSI val^

Returns


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()
: String val

Returns


erase

[Source]

Erases content. The direction to erase is dictated by the direction parameter. Use EraseLeft to erase everything from the cursor to the beginning of the line. Use EraseLine to erase the entire line. Use EraseRight to erase everything from the cursor to the end of the line. The default direction is EraseRight.

fun box erase(
  direction: (EraseLeft val | EraseLine val | EraseRight 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


eq

[Source]

fun box eq(
  that: ANSI val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: ANSI val)
: Bool val

Parameters

Returns