Primitives and Blocks
painted is built from a small set of immutable render-layer
value types. These are the inputs to every higher-level
feature — composition, buffers, the TUI, widgets.
Primitives Style, Cell, Span, Line
Rectangles Block
Style
Style is an immutable bundle of attributes — colors plus
bold/italic/underline/reverse/dim. Styles combine via
merge(), where the overlay wins.
base = Style(fg='blue', bold=True)
merged = base.merge(Style(italic=True))
bold
red
green
blue
dim italic
reverse cyan
Style attributes, rendered live
Cell
Cell is the atom: one character plus one Style. Most code
manipulates Blocks rather than individual cells.
Span and Line
Span is text plus Style, measured in display columns
(wide-char aware). A Line is a tuple of spans that paints
into a buffer or converts to a Block.