Expand description
Terminal styling: a tiny, dependency-free ANSI palette.
praxis-source is the workspace’s leaf crate (ADR-003) and must not pull in
any external dependency, so the palette is built from raw ANSI escape codes —
no colored, nu-ansi-term, or yansi. The output is identical to what
those crates produce; it is just spelled out here.
§Design
Palette gates whether styling is emitted at all, and is the set of
(foreground, weight) pairs the diagnostic renderer and the crash debugger
use. Palette::plain() is a no-op palette — the default for the Renderer
and for all snapshot tests, so diagnostics stay byte-stable across test runs;
the styled palette matches rustc’s conventions: errors red & bold, warnings
yellow &c.
Deciding when to style — the --color auto|always|never tri-state, and the
terminal check auto needs — is the CLI’s job; it resolves the flag and
hands down a Palette::from_enabled. Keeping that decision out of this
crate keeps the leaf free of terminal I/O.
Structs§
- Palette
- A palette: a function from
Styleto a sequence of SGR codes.plainproduces no codes at all (plain text);styledproduces rustc-like colors.