makeover-tui 0.57.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.

Named for the target and not for the library, the same way makeover-immediate is named for the mode and not for egui.

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::cutoff_for with the unit filled in, so every renderer drops a column at the same declared width.
  • 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 said with a modifier instead: muted text is dim, danger is bold, a link is underlined, the cursor row is reversed. Tones::NONE is a terminal with no colour to spend, and it still separates every role the drawings use.

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

Geometry, not colour. An edge occupies a whole cell per side, and a cell is roughly 8x17 pixels, so a one-pixel bevel becomes an order of magnitude heavier. frame returns a shrunk Rect rather than pretending the region survived. There is nowhere to put a corner radius, and a fill begins and ends on a cell boundary.

Colour matters only at sixteen colours. There a well cannot be filled distinctly and a bevel loses an edge, so frame carries depth with glyphs: a doubled frame for a raised surface, a light one for a well. Above sixteen colours that fallback never fires.

Fidelity::detect() reads COLORTERM then TERM and is deliberately credulous: an unrecognised terminal is assumed capable, and only the named fixed consoles get sixteen colours.

Palette::shows is a correctness check that a fill will be visible against what is behind it, at any depth.

Substitution is renderer policy

Substituting one intent for another belongs to a renderer, never to the description. Falling back from Fill::Well to Page is wrong here, because the page is usually the surface a well is cut into, so the substitution produces the invisibility it was meant to prevent.

Design and work

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

Licence

MIT.