Alaja (Alaja v1.0.0)

Copy Markdown View Source

Public facade for the Alaja terminal rendering framework.

Provides a simplified API for the most common operations: printing styled messages (print_success, print_error, print_warning, print_info), creating buffers and cells, converting colour formats, and rendering tables.

For advanced usage see the sub-modules directly: Alaja.Printer, Alaja.Components, and Alaja.Buffer.

Summary

Functions

Creates an empty cell (space, no colour, no effects).

Creates a new buffer with the given dimensions.

Prints a table to stdout.

Prints an error message (icon: ✗).

Prints an informational message (icon: ℹ).

Prints a success message (icon: ✓).

Prints a warning message (icon: ⚠).

Converts an RGB tuple to uppercase hex string.

Functions

empty()

@spec empty() :: Alaja.Cell.t()

Creates an empty cell (space, no colour, no effects).

Returns a %Cell{} struct filled with defaults.

new_buffer(width, height)

@spec new_buffer(non_neg_integer(), non_neg_integer()) :: Alaja.Buffer.t()

Creates a new buffer with the given dimensions.

Returns a %Buffer{} with width * height empty cells stored in a flat tuple for O(1) access.

print(opts)

@spec print(keyword() | list()) :: :ok

Prints a table to stdout.

Delegates to Alaja.Components.Table.print/2. Accepts a keyword list or a list of lists where the first row is treated as headers.

rgb_to_hex(arg)

@spec rgb_to_hex({byte(), byte(), byte()}) :: String.t()

Converts an RGB tuple to uppercase hex string.

Examples

iex> Alaja.rgb_to_hex({255, 180, 0})
"#FFB400"