ansi
ANSI escape sequences: remove them from captured output and build styled text.
strip, contains and visible_len deal with text that already has escape sequences (command
output, logs); Style and Color build the sequences for colors and attributes. Nothing here
decides whether a terminal supports colors: that stays with the caller.
Install
Section titled “Install”Cargo feature ansi (enabled by default). To compile only this module:
or in Cargo.toml:
Import path: helpers4::ansi.
| Item | What it does |
|---|---|
Color | A terminal color for Style. |
contains | Whether text contains an ANSI escape character (ESC, U+001B). |
strip | Removes the ANSI escape sequences from text, leaving what a terminal would display. |
Style | A text style: colors and attributes, applied to a string with paint. |
visible_len | The number of characters a terminal shows for text: its length once escape sequences are removed. |
