simvx.core.ui.ansi_parser¶
ANSI escape code parser — converts ANSI-styled text to StyledSpan sequences.
Module Contents¶
Classes¶
A segment of text with uniform styling. |
Functions¶
Parse ANSI-escaped text into a list of StyledSpans. |
|
Remove all ANSI escape sequences from text, returning plain content. |
Data¶
API¶
- simvx.core.ui.ansi_parser.__all__¶
[‘StyledSpan’, ‘ANSI_COLORS’, ‘parse_ansi’, ‘strip_ansi’]
- simvx.core.ui.ansi_parser.DEFAULT_FG: tuple[float, float, float, float]¶
(1.0, 1.0, 1.0, 1.0)
- class simvx.core.ui.ansi_parser.StyledSpan¶
A segment of text with uniform styling.
- text: str¶
None
- color: tuple[float, float, float, float]¶
None
- bg_color: tuple[float, float, float, float] | None¶
None
- bold: bool¶
False
- underline: bool¶
False
- simvx.core.ui.ansi_parser.ANSI_COLORS: list[tuple[float, float, float, float]]¶
[(0.0, 0.0, 0.0, 1.0), (0.8, 0.0, 0.0, 1.0), (0.0, 0.8, 0.0, 1.0), (0.8, 0.8, 0.0, 1.0), (0.0, 0.0, …
- simvx.core.ui.ansi_parser.parse_ansi(text: str) list[simvx.core.ui.ansi_parser.StyledSpan]¶
Parse ANSI-escaped text into a list of StyledSpans.
Each span carries the text segment and its styling attributes (color, background, bold, underline). Consecutive escape sequences without intervening text do not produce empty spans.
- simvx.core.ui.ansi_parser.strip_ansi(text: str) str¶
Remove all ANSI escape sequences from text, returning plain content.