Styles
A Style holds the colors and attributes of a cell or a text. Every field may be left out.
import TUI from "pkg/tui/tui"
TITLE = TUI.Style(fg: TUI.Color.Yellow, bold: true)
def warning(text: String) -> TUI.Node
TUI.text(text, TUI.merge(TITLE, TUI.Style(bg: TUI.Color.Red, underline: true)))
endfg,bg: aColor.Defaultis the terminal’s own color. The eight named colors (Black,Red,Green,Yellow,Blue,Magenta,Cyan,White) are for output modeNormal;Index(n)(0 to 255) forColors256;Rgb(r, g, b)(each 0 to 255) forTruecolor. A value out of range is an error when it is drawn.bold,dim,italic,underline,reverse:Bool.attrs: the attributes with no field of their own, fromAttr:Blink,Bright(bright colors in modeNormal),Strikeout,DoubleUnderline,Overline,Invisible. Terminals show some of them only.
TUI.App(..., output: mode) picks how the terminal reads colors: OutputMode.Normal, Colors256 or Truecolor.
Merge #
TUI.merge(base, over) puts over on top of base: the colors of over that are not Default, and the attributes of both. A box merges its style under the styles inside it.