terminal
terminal
¶
Terminal display helpers — ANSI colors and hanging-indent line wrapping.
Core color functions (supports_color, color, yellow, blue,
green, red) are defined in terok.lib.util.ansi so that
service-layer modules can use them without a cross-layer dependency.
This module re-exports them, adds higher-level color helpers, and provides
wrap_with_hanging_indent for prefix-aligned TUI label wrapping.
yes_no(value, enabled)
¶
Return green "yes" or red "no" based on value when enabled.
violet(text, enabled)
¶
gray(text, enabled)
¶
wrap_with_hanging_indent(prefix, body, suffix, width)
¶
Render prefix + body + suffix with continuation lines hanging-indented.
body wraps with wrap (so dashes are break points and
overlong segments fold by character). Continuation lines are prepended
with spaces aligning to the cell width of prefix, so they sit
underneath the start of body even when prefix contains emoji.
suffix attaches to the last body line if it fits; otherwise it lands on its own continuation line with the leading space stripped.
width ≤ 0, or a prefix already wider than width, disables wrapping and returns the inputs concatenated verbatim.