services/ansi library

Classes

AnsiSpan
A run of text that shares one SGR state.

Constants

kClearScreen → const String
The screen clear a child writes when it redraws from the top.
kForceAnsiEnvVar → const String
The environment variable revali up sets on a service it is drawing a pane for, and revali dev reads to turn its colour back on.
kRedrawDivider → const String
The rule a pane draws where a child cleared its own screen.

Functions

ansiForcedByParent([Map<String, String>? environment]) → bool
Whether the parent asked this process to dress its output for a terminal.
parseAnsi(String text) → List<AnsiSpan>
Splits text into runs of visible characters, each carrying the SGR state that was in effect when it was written.
stripAnsi(String text) → String
text with every escape sequence removed, leaving only what a reader sees.
withForcedAnsi<T>(T body()) → T
Runs body with mason_logger's colour forced on, if the parent asked.