ETee.Style (e_tee v0.1.0)

Copy Markdown View Source

Foreground, background, and text attributes for a cell.

Attributes are held as a bitmask; the predicates below test individual bits.

apply_sgr/2 takes the parameter shape the parser produces: a list of semicolon-separated parameters, each of which is itself a list of colon-separated subparameters. ESC[1;31m arrives as [[1], [31]], and ESC[38:2::10:20:30m as [[38, 2, nil, 10, 20, 30]]. A reset clears colour and attributes but leaves hyperlink untouched.

Summary

Functions

Fold a Select Graphic Rendition parameter list into a style.

True when the blink attribute is set.

True when the bold attribute is set.

The style a freshly reset terminal writes with.

True when the style carries no colour and no attributes.

True when the dim attribute is set.

True when the double underline attribute is set.

True when the hidden attribute is set.

True when the italic attribute is set.

True when the reverse video attribute is set.

True when the strikethrough attribute is set.

True when the single underline attribute is set.

Types

params()

@type params() :: [[integer() | nil]]

t()

@type t() :: %ETee.Style{
  attrs: non_neg_integer(),
  bg: ETee.Color.t(),
  fg: ETee.Color.t(),
  hyperlink: String.t() | nil
}

Functions

apply_sgr(style, params)

@spec apply_sgr(t(), params()) :: t()

Fold a Select Graphic Rendition parameter list into a style.

An empty parameter list is a reset, matching ESC[m.

blink?(style)

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

True when the blink attribute is set.

bold?(style)

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

True when the bold attribute is set.

default()

@spec default() :: t()

The style a freshly reset terminal writes with.

default?(style)

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

True when the style carries no colour and no attributes.

dim?(style)

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

True when the dim attribute is set.

double_underline?(style)

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

True when the double underline attribute is set.

hidden?(style)

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

True when the hidden attribute is set.

italic?(style)

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

True when the italic attribute is set.

reverse?(style)

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

True when the reverse video attribute is set.

strikethrough?(style)

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

True when the strikethrough attribute is set.

underline?(style)

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

True when the single underline attribute is set.