beamtea_term (beamtea v0.1.2)

View Source

Low-level ANSI/VT terminal escape sequences.

Every function returns an iodata() escape string that can be embedded directly in a view or written to the terminal. Kept deliberately small and dependency-free so it is trivial to unit-test on any platform.

Summary

Functions

Switch to the alternate screen buffer (like vim/less).

Restore the primary screen buffer.

256-colour background.

24-bit truecolor background.

Clear the whole screen.

Clear from the cursor to the end of the screen.

Clear from the cursor to the end of the current line.

256-colour foreground.

24-bit truecolor foreground.

Move the cursor to the top-left corner.

Move the cursor to a 1-indexed {Row, Col}.

Wrap Text in the given SGR codes and reset afterwards.

Paint Text in a truecolor {R, G, B} foreground and reset.

Reset all attributes.

A horizontal rule: Glyph repeated to Width columns.

Build an SGR sequence from a list of numeric codes, e.g. sgr([1, 38, 5, 205]).

Functions

alt_enter()

-spec alt_enter() -> binary().

Switch to the alternate screen buffer (like vim/less).

alt_leave()

-spec alt_leave() -> binary().

Restore the primary screen buffer.

bg(N)

-spec bg(0..255) -> iodata().

256-colour background.

bg_rgb(R, G, B)

-spec bg_rgb(0..255, 0..255, 0..255) -> iodata().

24-bit truecolor background.

bold(Text)

-spec bold(iodata()) -> iodata().

clear()

-spec clear() -> binary().

Clear the whole screen.

clear_below()

-spec clear_below() -> binary().

Clear from the cursor to the end of the screen.

clear_line()

-spec clear_line() -> binary().

Clear from the cursor to the end of the current line.

faint(Text)

-spec faint(iodata()) -> iodata().

fg(N)

-spec fg(0..255) -> iodata().

256-colour foreground.

fg_rgb(R, G, B)

-spec fg_rgb(0..255, 0..255, 0..255) -> iodata().

24-bit truecolor foreground.

hide_cursor()

-spec hide_cursor() -> binary().

home()

-spec home() -> binary().

Move the cursor to the top-left corner.

italic(Text)

-spec italic(iodata()) -> iodata().

move(Row, Col)

-spec move(pos_integer(), pos_integer()) -> iodata().

Move the cursor to a 1-indexed {Row, Col}.

paint(Codes, Text)

-spec paint([non_neg_integer()], iodata()) -> iodata().

Wrap Text in the given SGR codes and reset afterwards.

paint_rgb(_, Text)

-spec paint_rgb({0..255, 0..255, 0..255}, iodata()) -> iodata().

Paint Text in a truecolor {R, G, B} foreground and reset.

reset()

-spec reset() -> binary().

Reset all attributes.

reverse(Text)

-spec reverse(iodata()) -> iodata().

rule(Width)

-spec rule(non_neg_integer()) -> iodata().

Equivalent to rule(Width, <<"─"/utf8>>).

rule(Width, Glyph)

-spec rule(non_neg_integer(), binary()) -> iodata().

A horizontal rule: Glyph repeated to Width columns.

sgr(Codes)

-spec sgr([non_neg_integer()]) -> iodata().

Build an SGR sequence from a list of numeric codes, e.g. sgr([1, 38, 5, 205]).

show_cursor()

-spec show_cursor() -> binary().

underline(Text)

-spec underline(iodata()) -> iodata().