Skip to content

std:text/Style

Canonical occurrence: protos/lib/text/Style.protos · Protos revision: e99b712ecf658a527b1fe82c8beba2c1286d8dc9.

Immutable text styles. A style is a frozen semantic value describing how text should be presented; it carries no rendering, terminal, or encoding behavior of its own. A style’s state is opaque: no slot, method, or other public operation exposes it.

Styles answer semantic equality through ==: two styles are equal when both are styles constructed from the same foreground. hash is coherent with that equality, so independently constructed equal styles work as the same Map key. === remains ordinary object identity, and every construction answers a fresh style.

Only values constructed by this module are styles. recognizes never invokes behavior of the candidate, so an object that merely has similar slots, parent, or shape is not a style.

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.

Answers a fresh frozen style whose foreground is foreground, which must be exactly one of the Strings "default", "black", "red", "green", "yellow", "blue", "magenta", "cyan", or "white". Any other argument signals an Error; no argument is converted, case-folded, or defaulted.

No callable shape is mechanically recorded for this slot.

Answers true exactly when value is a style constructed by this module. Answers false for any other value, including this module and objects with the same slots or parent. The candidate is neither copied, converted, nor sent any message.

No callable shape is mechanically recorded for this slot.

Exact module source · Standard-library API · Standard library overview