Skip to content
ConsoleMonster

API Reference

Class

SgrEncoder

Namespace ConsoleMonster.Rendering
Assembly ConsoleMonster
Modifiers static

Encodes styles as SGR (Select Graphic Rendition) sequences for a colour depth. Every style change emits a full reset plus the new attributes, which is robust on every VT implementation (conhost, Windows Terminal, xterm.js) and keeps frames independent of any previous terminal state.

Inheritance

  • Object
  • SgrEncoder

Methods

public static Void Append(StringBuilder builder, Style style, ColorDepth depth) #
Returns: Void

Appends the SGR sequence for a style (including the reset prefix).

Parameters

builder System.Text.StringBuilder requiredposition: 0
The target.
style ConsoleMonster.Styling.Style requiredposition: 1
The style.
depth ConsoleMonster.Capabilities.ColorDepth requiredposition: 2
The colour depth; colours are downsampled to it.
public static String Encode(Style style, ColorDepth depth) #
Returns: String

Returns the SGR sequence for a style.

Parameters

style ConsoleMonster.Styling.Style requiredposition: 0
The style.
depth ConsoleMonster.Capabilities.ColorDepth requiredposition: 1
The colour depth.

Returns

The sequence, or an empty string for ColorDepth.None.

Fields

public const String Reset #

The reset sequence.

Value: