Skip to main content

Module style

Module style 

Source
Expand description

Fixed colors, OSC 8 links, and escape-aware width measuring for static output.

Constants§

BOLD
BRANCH
BRANCH_BOLD
DIM
GREEN
LINK
RED
UPSTREAM
YELLOW

Functions§

link
OSC 8 hyperlink. Emitted even without color: links are not styling.
no_color_env
True when NO_COLOR is set to a non-empty value.
paint
Wraps s in an SGR sequence, or returns it unchanged when color is false.
sanitize
Makes untrusted text (file names, server messages) inert: control chars (C0, DEL, C1) become \xNN, tab becomes a space. Prevents terminal escape injection.
strip_escapes
Removes CSI (ESC [ ... final) and OSC (ESC ] ... ST|BEL) sequences.
truncate
Cuts plain text to at most max columns, ending with … when cut.
visible_width
Display width of the visible text, ignoring escapes.