makeover-tui 0.68.0

The terminal renderer for makeover-layout, on ratatui. Colour stops being the constraint above 256 entries; geometry never does, because an edge occupies a whole cell on every side.
Documentation

makeover-tui

The terminal renderer for makeover-layout, on ratatui.

What is here

  • frame and paint_bevel: a described surface's depth, drawn in cells.
  • table: columns, narrowing, cell parts and the sort caret, over ratatui's own Table. Narrowing is makeover_layout::ColumnRoom::cutoff_for at one cell per ch.
  • piece: the resolved ink, a badge or chip, and the wait marks. The vocabulary's members (a meter, a control, a figure, facts, a form field, a chart) are drawn by quasi-tui, which owns those types, on top of that ink.
  • text: a word wrap whose height and drawing come from one measurement.
  • theme (feature theme): a loaded makeover theme resolved into ratatui colours and quantised for the terminal's colour depth.

Colours and marks

Every colour is in the Palette: the surfaces and bevel pair a frame needs, and the Tones text and tables are drawn in. PieceStyle and TableStyle carry metrics and marks only (cell counts, glyphs, the focus modifier). piece::Ink and table::TableInk are the two resolved together, once per frame, and every drawing takes one.

A tone the palette leaves empty is drawn in the terminal's own ink, and some roles are said with a modifier instead: muted and disabled text are dim, danger is bold, an action is underlined, a filled control and the cursor row are reversed. Tones::NONE leaves every tone empty.

With a theme:

let theme = Theme::from_theme(&colors)?.for_terminal(fidelity);
let palette = theme.palette(fidelity);
let ink = piece::Ink::new(&palette, &piece::PieceStyle::default());
let tables = table::TableInk::new(&palette, &table::TableStyle::default());

What a terminal costs

An edge occupies a whole cell per side, so frame returns the Rect one cell in from each edge it drew. A frame has no corner radius, and a fill begins and ends on a cell boundary.

Colour matters only at sixteen colours and with no colour at all (Fidelity::Ansi16 and Fidelity::NoColor). There a well cannot be filled distinctly and a bevel loses an edge, so frame carries depth with box-drawing glyphs: a doubled frame for a raised surface, a light one for every other depth. Above sixteen colours the bevel is drawn in half-blocks.

Fidelity::detect() reads NO_COLOR first (any non-empty value gives Fidelity::NoColor), then COLORTERM, then TERM. Sixteen colours is reached by the fixed consoles (linux, vt100, vt220, ansi, dumb) and by a TERM containing 16color; an unrecognised terminal is assumed truecolor.

frame paints a fill only where Palette::shows says it differs from what is behind it, at any depth.

No substitution

This renderer does not substitute one intent for another: Palette::fill returns None for an intent it has no colour for, and Fill::Well does not fall back to Page.

Design and work

Design lives in the wiki note makeover-tui; work is tracked in GoingsOn under the makeover project.

Licence

MIT.