Skip to content

KgpToken ​

Namespace: Hex1b.Tokens

Assembly: Hex1b.dll

Represents a Kitty Graphics Protocol (KGP) command: ESC _G ... ST

csharp
public sealed record KgpToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<KgpToken>

Inheritance ​

Object → AnsiToken → KgpToken

Implements ​

Constructors ​

KgpToken(string, string) ​

Represents a Kitty Graphics Protocol (KGP) command: ESC _G ... ST

Parameters:

  • ControlData (String): The control data portion (comma-separated key=value pairs) before the semicolon.
  • Payload (String): The base64-encoded payload after the semicolon, or empty if no payload.
csharp
public KgpToken(string ControlData, string Payload)

Properties ​

ControlData ​

The control data portion (comma-separated key=value pairs) before the semicolon.

Returns: String

csharp
public string ControlData { get; init; }

Payload ​

The base64-encoded payload after the semicolon, or empty if no payload.

Returns: String

csharp
public string Payload { get; init; }

Remarks ​

KGP uses APC (Application Programming Command) escape sequences with a 'G' prefix: ESC _G &lt;control data&gt; ; &lt;payload&gt; ESC \

The control data contains comma-separated key=value pairs that describe the graphics command (action, format, dimensions, IDs, etc.). The payload is base64-encoded pixel data or file paths.

Protocol specification: https://sw.kovidgoyal.net/kitty/graphics-protocol/

Released under the MIT License.