std:text/ANSI
std:text/ANSI
Section titled “std:text/ANSI”Canonical occurrence:
protos/lib/text/ANSI.protos· Protos revision:e99b712ecf658a527b1fe82c8beba2c1286d8dc9.
Pure rendering of std:text/StyledText values to Strings with ANSI SGR
foreground sequences. Rendering only transforms its arguments: it consults
no environment, terminal, process, writer, or global configuration, and
whether styling is enabled is decided entirely by the caller.
Run text is copied unchanged. The renderer is neither a sanitizer nor an ANSI parser: escape and other control characters already present in the text pass through as content, and only the sequences the renderer itself generates are known to it.
Observable top-level slots
Section titled “Observable top-level slots”This page lists the complete mechanically observable top-level slot inventory required by D067. Authored documentation, when present, is canonical D062 prose; mechanical presence alone does not create a stability or compatibility promise.
render
Section titled “render”Answers the String rendering of styledText, which must be a styled text
recognized by std:text/StyledText. stylingEnabled must be exactly
true or false; any other argument signals an Error, and no argument is
converted.
With false the result is the text of every run, in order, and contains
no generated escape sequence. With true each non-default foreground
starts with its SGR sequence (ESC[30m black, ESC[31m red, ESC[32m
green, ESC[33m yellow, ESC[34m blue, ESC[35m magenta, ESC[36m cyan,
ESC[37m white). Leaving a foreground for the default foreground, for a
different foreground, or at the end of the result emits ESC[0m first.
Default-foreground text, and empty styled text, generate no sequence.
Mechanical facts
Section titled “Mechanical facts”No callable shape is mechanically recorded for this slot.
- Source occurrence:
protos/lib/text/ANSI.protos:38 - Exact source page: open in the source browser
Exact module source · Standard-library API · Standard library overview