Skip to content

Style

Reusable terminal style settings.

Calling a Style applies its saved settings. Supplied options override saved colors or enable additional attributes; omitted options retain saved settings, and :INHERIT: clears them.

Constructor

Style ...options

Creates a reusable style.

To style text as well, use text.

Parameters

NameTypeDescription
...options The style options.

Example

let warning = term.Style fg: :YELLOW: bold: true

Methods

(call) ...args -> Text

Applies or derives the saved style.

Also accepts the style options, which override what is saved.

Parameters

NameTypeDescription
...args Values converted to display strings.

Returns

Text when positional arguments are given, otherwise a derived Style.

Example

let warning = term.Style fg: :YELLOW: bold: true
let urgent = warning fg: :RED: underline: true
let uncolored = urgent fg: :INHERIT:

echo $warning("Warning")
echo $urgent("Failure")
echo $uncolored("Notice")