Skip to main content

Crate makeover_tui

Crate makeover_tui 

Source
Expand description

The terminal renderer for makeover_layout.

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

§What a terminal actually costs you

Not colour. That was the original assumption here and it is wrong on any terminal built this decade. Measured across the 31 shipped themes (makeover’s well_fidelity example):

ANSI-16ANSI-256truecolor
a well collapses onto its face18/314/312/31
at least one bevel edge vanishes into its face31/314/310

The threshold is 256, not 24-bit, and the two failures that survive at truecolor are not terminal failures at all: they are the themes whose raised surface is already white, so the lightening clamps and the well lands exactly on its face. Those render identically in a browser. makeover’s own well_is_distinct_from_its_face test already names them.

What a terminal costs is geometry, and no amount of colour fixes it. An edge occupies a whole cell on each side. A cell is roughly 8x17 pixels, so a one-pixel bevel becomes something an order of magnitude heavier, which is why frame hands back a shrunk Rect instead of pretending the region survived intact. There is nowhere to put a corner radius, so radius_control and radius_container mean the same thing here. A fill can only begin and end on a cell boundary.

That is the constraint worth designing against. It does not improve, it is not detectable, and it applies equally to the best terminal ever written.

§Where fidelity does matter

At Fidelity::Ansi16 the depth vocabulary collapses outright: a well cannot be filled distinctly on most themes and a bevel loses an edge on every one of them, so a raised card and a well both read as a single-tone box. Colour cannot carry the distinction, so frame carries it with the glyphs instead.

Above that, colour carries it and the glyph fallback never fires.

Palette::shows is worth reading correctly in light of the numbers: it is not a low-colour workaround. It is a correctness check that a fill will be visible against what is behind it, and at truecolor it fires on exactly the two clamping themes, which is precisely when it should.

§The correction this renderer forced

makeover_layout::Fill briefly carried a fallback method, returning Page for Well so a consumer without surface-well had something to use. That is an answer for a renderer that can always paint a colour. Here it is actively wrong: page is the surface a well is usually cut into, so falling back to it produces the exact invisibility the fallback was meant to avoid.

Substituting one intent for another is renderer policy, not description. The fallback moved out of the description and into makeover-immediate, where it belongs, which is the first thing a second renderer was built to find.

Structs§

Palette
The resolved colours this renderer needs.

Enums§

Fidelity
How many colours the terminal can actually show.

Functions§

frame
Draw a region at a given Depth and return the area left for content.
paint_bevel
Paint a two-tone edge around the outside of area.