Alaja.ANSI (Alaja v1.0.0)

Copy Markdown View Source

Pure ANSI escape code generators.

Returns strings containing ANSI escape sequences for cursor control, screen manipulation, true-colour foreground/background, mouse event handling, and alternate screen buffers.

Summary

Functions

Switches back to normal screen buffer.

Switches to alternate screen buffer.

Sets 24-bit true-color background.

Turns bold text on (alias for bold_on/0).

Turns bold text on.

Clears the entire screen (alias for clear_screen/0).

Clears the current line.

Clears the entire screen.

Moves cursor to home position (1,1).

Turns faint/dim text on (alias for faint_on/0).

Turns faint/dim text on.

Sets 24-bit true-color foreground.

Hides the terminal cursor.

Turns italic text on (alias for italic_on/0).

Turns italic text on.

Disables mouse tracking.

Enables mouse tracking (SGR extended mode).

Disables SGR mouse mode.

Enables SGR mouse mode.

Moves cursor to position (alias for move_to/2).

Moves cursor to position (1-indexed).

Resets all text attributes.

Restores cursor position.

Saves cursor position.

Shows the terminal cursor.

Turns underline on.

Functions

alt_screen_off()

@spec alt_screen_off() :: String.t()

Switches back to normal screen buffer.

alt_screen_on()

@spec alt_screen_on() :: String.t()

Switches to alternate screen buffer.

bg(r, g, b)

@spec bg(0..255, 0..255, 0..255) :: String.t()

Sets 24-bit true-color background.

Returns ANSI escape: \e[48;2;R;G;Bm

bold()

@spec bold() :: String.t()

Turns bold text on (alias for bold_on/0).

bold_on()

@spec bold_on() :: String.t()

Turns bold text on.

clear()

@spec clear() :: String.t()

Clears the entire screen (alias for clear_screen/0).

clear_line()

@spec clear_line() :: String.t()

Clears the current line.

clear_screen()

@spec clear_screen() :: String.t()

Clears the entire screen.

cursor_home()

@spec cursor_home() :: String.t()

Moves cursor to home position (1,1).

dim()

@spec dim() :: String.t()

Turns faint/dim text on (alias for faint_on/0).

faint_on()

@spec faint_on() :: String.t()

Turns faint/dim text on.

fg(r, g, b)

@spec fg(0..255, 0..255, 0..255) :: String.t()

Sets 24-bit true-color foreground.

Returns ANSI escape: \e[38;2;R;G;Bm

hide_cursor()

@spec hide_cursor() :: String.t()

Hides the terminal cursor.

italic()

@spec italic() :: String.t()

Turns italic text on (alias for italic_on/0).

italic_on()

@spec italic_on() :: String.t()

Turns italic text on.

mouse_off()

@spec mouse_off() :: String.t()

Disables mouse tracking.

mouse_on()

@spec mouse_on() :: String.t()

Enables mouse tracking (SGR extended mode).

mouse_sgr_off()

@spec mouse_sgr_off() :: String.t()

Disables SGR mouse mode.

mouse_sgr_on()

@spec mouse_sgr_on() :: String.t()

Enables SGR mouse mode.

move(x, y)

@spec move(non_neg_integer(), non_neg_integer()) :: String.t()

Moves cursor to position (alias for move_to/2).

move_to(col, row)

@spec move_to(pos_integer(), pos_integer()) :: String.t()

Moves cursor to position (1-indexed).

col is the column (x), row is the row (y).

reset()

@spec reset() :: String.t()

Alias for reset_attributes/0.

reset_attributes()

@spec reset_attributes() :: String.t()

Resets all text attributes.

restore_cursor()

@spec restore_cursor() :: String.t()

Restores cursor position.

save_cursor()

@spec save_cursor() :: String.t()

Saves cursor position.

show_cursor()

@spec show_cursor() :: String.t()

Shows the terminal cursor.

underline_on()

@spec underline_on() :: String.t()

Turns underline on.