TermColor.Text: styled text and spans #
Text is a sequence of styled segments. The representation is deliberately small and
transparent: append preserves order, and rendering is a pure fold over the segments.
@[instance_reducible]
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- TermColor.instReprSegment = { reprPrec := TermColor.instReprSegment.repr }
Text with styles attached to segments.
Ordered styled segments.
Instances For
@[instance_reducible]
Equations
Equations
- TermColor.instBEqText.beq { segments := a } { segments := b } = (a == b)
- TermColor.instBEqText.beq x✝¹ x✝ = false
Instances For
@[instance_reducible]
@[instance_reducible]
Equations
- TermColor.instReprText = { reprPrec := TermColor.instReprText.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
An empty text value.
Equations
Instances For
Attach a terminal hyperlink to all segments in a text value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- TermColor.Text.instEmptyCollection = { emptyCollection := TermColor.Text.empty }
@[instance_reducible]
Equations
- TermColor.Text.instAppend = { append := TermColor.Text.append }
Concatenate text values in order.
Equations
- TermColor.Text.concat texts = { segments := List.flatMap (fun (x : TermColor.Text) => x.segments) texts }
Instances For
Style every character of a string from its index and the total character count.
Equations
Instances For
Sweep the hue wheel across the characters of a string.
Equations
- TermColor.Text.rainbow text = TermColor.Text.perChar text fun (i n : Nat) => TermColor.Style.fg (TermColor.Color.hue (i * 330 / max n 1))
Instances For
Remove all ANSI styling while preserving the visible text.
Equations
- text.plainText = String.join (List.map (fun (segment : TermColor.Segment) => segment.text) text.segments)
Instances For
Render one segment for a terminal target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]
Plain targets preserve text and suppress both styles and hyperlinks.
Render styled text, optionally emitting OSC-8 hyperlinks for linked segments.
Equations
- TermColor.Text.render target text = String.join (List.map (fun (segment : TermColor.Segment) => TermColor.Text.renderSegment target segment) text.segments)