TermColor.Ansi: pure ANSI SGR encoding #
This module has no terminal detection and performs no IO. A RenderTarget makes the fallback
policy explicit, so the same styled value can be rendered as plain text, ANSI-16, ANSI-256, or
true color, with optional OSC-8 hyperlinks.
Whether styles are emitted, and how much color precision is available.
- styles : Bool
Whether SGR styles are emitted.
- colors : ColorLevel
Maximum color precision available to the renderer.
- hyperlinks : Bool
Whether OSC-8 hyperlinks are emitted.
Instances For
Equations
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
A plain-text target with no styles or colors.
Equations
- TermColor.RenderTarget.plain = { styles := false, colors := TermColor.ColorLevel.none }
Instances For
An ANSI-16 target.
Equations
Instances For
An xterm 256-color target.
Equations
Instances For
A true-color target.
Equations
Instances For
Enable OSC-8 hyperlinks while preserving the target's color and style policy.
Equations
Instances For
The SGR layer to which a color is applied.
Instances For
Equations
Equations
- TermColor.instBEqLayer.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- TermColor.instReprLayer.repr TermColor.Layer.foreground prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "TermColor.Layer.foreground")).group prec✝
- TermColor.instReprLayer.repr TermColor.Layer.background prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "TermColor.Layer.background")).group prec✝
Instances For
Equations
- TermColor.instReprLayer = { reprPrec := TermColor.instReprLayer.repr }
Encode a color for one SGR layer at a given terminal color level.
Equations
- TermColor.Color.sgrCodes layer TermColor.ColorLevel.none color = []
- TermColor.Color.sgrCodes layer TermColor.ColorLevel.ansi16 color = TermColor.Color.ansi16Codes✝ layer color
- TermColor.Color.sgrCodes layer TermColor.ColorLevel.ansi256 color = TermColor.Color.ansi256Codes✝ layer color
- TermColor.Color.sgrCodes layer TermColor.ColorLevel.trueColor color = TermColor.Color.trueColorCodes✝ layer color
Instances For
The SGR parameter string for a style at a target capability.
Equations
- TermColor.Style.sgrParameters target style = if (!target.styles) = true then [] else List.flatMap (TermColor.Style.settingCodes✝ target) style.settings
Instances For
Encode a style as an SGR opening sequence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Wrap plain text in an opening SGR sequence and a complete reset.
Equations
- One or more equations did not get rendered due to their size.