ansiWrap()function
ansiWrap(input: string, ...wrappers: ImmutableArray<string>): void
| Param | Type | |
|---|---|---|
input | string | The string to wrap in ANSI codes. required |
wrappers | ImmutableArray<string> |
| Return | |
|---|---|
unknown | The wrapped string, or input unchanged when colour is not supported (see precedence above). |
Wrap a string in the ANSI color/style codes (at the start), and ANSI_RESET at the end.
- Colour is only emitted when the runtime supports it, resolved once at module load into
_USES_COLOR—FORCE_COLOR>NO_COLOR> TTY detection > default-off. - The default is off for non-interactive sinks (files, log aggregators, Workers), so escape codes never pollute non-TTY output unless
FORCE_COLORopts back in.