SgrToken
Namespace: Hex1b.Tokens
Assembly: Hex1b.dll
Represents a CSI Select Graphic Rendition command (SGR): ESC [ params m
public sealed record SgrToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SgrToken>Inheritance
Implements
Constructors
SgrToken(string)
Represents a CSI Select Graphic Rendition command (SGR): ESC [ params m
Parameters:
Parameters(String): The raw SGR parameter string (e.g., "1;38;2;255;0;0" for bold red). Empty string or null represents reset (ESC[m or ESC[0m).
public SgrToken(string Parameters)Properties
Parameters
The raw SGR parameter string (e.g., "1;38;2;255;0;0" for bold red). Empty string or null represents reset (ESC[m or ESC[0m).
Returns: String
public string Parameters { get; init; }Methods
Equals(SgrToken?)
Indicates whether the current object is equal to another object of the same type.
Parameters:
other(SgrToken): An object to compare with this object.
Returns: Boolean
true if the current object is equal to the other parameter; otherwise, false.
public bool Equals(SgrToken? other)GetHashCode()
Serves as the default hash function.
Returns: Int32
A hash code for the current object.
public override int GetHashCode()Fields
Reset
SGR reset - clears all attributes and colors.
Returns: SgrToken
public static readonly SgrToken ResetRemarks
We preserve the raw parameter string rather than interpreting it, because: SGR sequences can be complex (256-color, RGB, combined attributes)Filters may want to pass through unchangedPreserves the original encoding for faithful serialization
Common SGR codes: 0 = Reset all1 = Bold, 2 = Dim, 3 = Italic, 4 = Underline30-37 = Foreground colors, 40-47 = Background colors38;5;N = 256-color foreground, 38;2;R;G;B = RGB foreground