Ghostty.Terminal.Cell (Ghostty v0.4.1)

Copy Markdown View Source

Helpers for working with terminal cell tuples.

Each cell is {grapheme, fg, bg, flags} where:

  • grapheme — UTF-8 binary (empty for blank cells)
  • fg / bg{r, g, b} tuples or nil
  • flags — bitmask of style attributes

Flag bits

BitAttribute
0bold
1italic
2faint
3underline
4strikethrough
5inverse
6blink
7overline

Summary

Functions

Returns the background color or nil.

Returns true if the cell is blank (empty grapheme, no styling).

Returns the foreground color or nil.

Returns the raw flags bitmask.

Returns the grapheme string.

Types

color()

@type color() :: {0..255, 0..255, 0..255} | nil

t()

@type t() :: {binary(), color(), color(), non_neg_integer()}

Functions

bg(arg)

@spec bg(t()) :: color()

Returns the background color or nil.

blank?(arg)

@spec blank?(t()) :: boolean()

Returns true if the cell is blank (empty grapheme, no styling).

blink?(arg)

@spec blink?(t()) :: boolean()

bold?(arg)

@spec bold?(t()) :: boolean()

faint?(arg)

@spec faint?(t()) :: boolean()

fg(arg)

@spec fg(t()) :: color()

Returns the foreground color or nil.

flags(arg)

@spec flags(t()) :: non_neg_integer()

Returns the raw flags bitmask.

grapheme(arg)

@spec grapheme(t()) :: binary()

Returns the grapheme string.

inverse?(arg)

@spec inverse?(t()) :: boolean()

italic?(arg)

@spec italic?(t()) :: boolean()

overline?(arg)

@spec overline?(t()) :: boolean()

strikethrough?(arg)

@spec strikethrough?(t()) :: boolean()

underline?(arg)

@spec underline?(t()) :: boolean()