backend library

Provides backend implementations for interacting with terminal APIs.

It defines the SurfaceBackend interface, which is a low-level interface for drawing cells to a terminal-like surface, with a default implementation, SurfaceBackend.fromStdout, that writes to a io.Stdout stream.

For building custom backends, or terminal emulators, AnsiSurfaceBackend uses ANSI escape sequences to interact with the terminal, and helper types such as Sequence, EscapeSequence, Command and utility extension such as AnsiEscapedStyle are provided.

Classes

BufferedKeys
A minimal buffer interface for synchronously reading the state of keys.
Command
An interface for a command that performs an action on a terminal.
EscapeSequence
A CSI escape sequence.
Literal
A string literal.
MoveCursorTo
Moves the terminal cursor to the given position (row, column).
MoveCursorToColumn
Moves the terminal cursor to the given column.
Print
A command that prints text to the terminal.
Sequence
Represents a sequence of values; a Literal or EscapeSequence.
SetBackgroundColor256
Sets the background color to one of the 256 colors.
SetColor16
Sets either the foreground or background color to one of 16 colors.
SetForegroundColor256
Sets the foreground color to one of the 256 colors.
SurfaceBackend
Abstraction over accessing lower-level terminal-like output APIs.
TestSurfaceBackend
A backend implementation used for integration testing.

Enums

AlternateScreenBuffer
Enters or leaves the alternate screen buffer.
ClearScreen
Clears the terminal screen buffer.
SetCursorVisibility
Sets the cursor visibility.
SynchronizedUpdate
Instructs the terminal to start or end a synchronized update.

Mixins

AnsiSurfaceBackend
A partial implementation of SurfaceBackend that writes ANSI sequences.

Extensions

AnsiEscapedColor on Color
Provides conversion from a Color to ANSI escape sequences.
AnsiEscapedColor16 on Color16
Provides utilities for working with 16-color ANSI escape sequences.
AnsiEscapedStyle on Style
Provides conversion from a Style to ANSI escape sequences.

Constants

resetStyle → const Command
Resets both colors and all text attributes to the default.