Expand description
Tasteful terminal styling for Heddle CLI output.
Heddle’s brand voice (“precise, calm, conversational”) translates to a deliberately restrained terminal palette: dim/bright contrast and bold weight do most of the structural work; saturated color appears only at semantic seams (success/warning/error, confidence band, identity vs. id). No rainbow output, no syntax highlighting density.
Color decisions are made once at CLI startup via
init_from_cli, which consults — in precedence order:
--no-colorCLI flag (force off)NO_COLORenv var (per https://no-color.org) — force offCLICOLOR_FORCE=1env var — force on, even on a non-TTY- stdout isatty — auto-detected default
The decision is stored in a process-wide [OnceLock] so render
sites consult a bool rather than re-querying the environment per
line. JSON output is always uncolored; that decision happens at
the print site, not here — should_output_json short-circuits
before any styled helper runs.
Functions§
- accent
- Success/positive/current — warm sage/green (ANSI 8-bit 71).
- bold
- Structural emphasis — intent text, headers, the principal name.
- change_
id - Change-id styling: dim. We don’t apply a monospace marker here — terminals already render text monospaced. The “dim+monospace” label in the spec was about visual treatment, which the terminal grants for free.
- color_
enabled - Returns the active color decision. If
init_from_cliwas never called (e.g. in a library test that bypassesmain), this defaults tofalseto avoid leaking escapes. - confidence
- Confidence band: maps the recorded numeric value to a semantic
color. Render the formatted text yourself (e.g. via
format_confidence) and pass it here; this keeps the formatting rule inrepoand the styling rule here. - count
- Render a compact count with the number emphasized.
- dim
- De-emphasis — used for IDs, timestamps, paths, and other text that’s structurally important but shouldn’t draw the eye.
- error
- Hard error — muted rust (ANSI 8-bit 167).
- error_
marker - Small failure status marker.
- field
- Render a calm label/value row.
- init_
from_ cli - Resolve the color decision once at CLI startup.
- ok_
marker - Small successful status marker. Keep the word short so it scans like a status glyph but still works in plain terminals.
- principal
- Principal styling: name in bold, email dimmed. Returns the
pre-composed
"Name <email>"string so callers don’t have to thread two fragments throughprintln!arguments. - section
- Section heading used for human output blocks.
- thread_
state - Thread-state styling:
active/ready/promotedare accent;merged/abandonedare dim (historical, not current);blocked/stale/draftare warn. Unknown variants fall back to plain text. The matcher is case-insensitive against theDisplayform so callers can passstate.to_string()directly. - warn
- Mid-warning — warm amber (ANSI 8-bit 178).
- warn_
marker - Small warning status marker.
- working_
marker - Small in-progress status marker.