Skip to content

TerminalCell

Namespace: Hex1b

Assembly: Hex1b.dll

Represents a single cell in the virtual terminal screen buffer.

csharp
public readonly record struct TerminalCell : IEquatable<TerminalCell>

Implements

Constructors

TerminalCell(string, Hex1bColor?, Hex1bColor?, CellAttributes, long, DateTimeOffset, TrackedObject<SixelData>?, TrackedObject<HyperlinkData>?, Hex1bColor?, UnderlineStyle)

Represents a single cell in the virtual terminal screen buffer.

Parameters:

  • Character (String): The grapheme cluster (user-perceived character) displayed in this cell. May be multiple code points for emoji, combining characters, etc.
  • Foreground (Nullable<Hex1bColor>): The foreground color, or null for default.
  • Background (Nullable<Hex1bColor>): The background color, or null for default.
  • Attributes (CellAttributes): Text styling attributes (bold, italic, etc.).
  • Sequence (Int64): The write order of this cell. Higher values were written later. Used for z-ordering during rendering.
  • WrittenAt (DateTimeOffset): The timestamp when this cell was written. Useful for debugging and future animation features.
  • TrackedSixel (TrackedObject<SixelData>): Optional tracked reference to Sixel graphics data associated with this cell.
  • TrackedHyperlink (TrackedObject<HyperlinkData>): Optional tracked reference to hyperlink data associated with this cell.
  • UnderlineColor (Nullable<Hex1bColor>): The underline color (SGR 58), or null to use the foreground color.
  • UnderlineStyle (UnderlineStyle): The underline style (SGR 4:x). Defaults to .
csharp
public TerminalCell(string Character, Hex1bColor? Foreground, Hex1bColor? Background, CellAttributes Attributes = CellAttributes.None, long Sequence = 0, DateTimeOffset WrittenAt = default, TrackedObject<SixelData>? TrackedSixel = null, TrackedObject<HyperlinkData>? TrackedHyperlink = null, Hex1bColor? UnderlineColor = null, UnderlineStyle UnderlineStyle = UnderlineStyle.None)

Properties

Attributes

Text styling attributes (bold, italic, etc.).

Returns: CellAttributes

csharp
public CellAttributes Attributes { get; init; }

Background

The background color, or null for default.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? Background { get; init; }

Character

The grapheme cluster (user-perceived character) displayed in this cell. May be multiple code points for emoji, combining characters, etc.

Returns: String

csharp
public string Character { get; init; }

Foreground

The foreground color, or null for default.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? Foreground { get; init; }

HasHyperlinkData

Gets whether this cell has associated hyperlink data.

Returns: Boolean

csharp
public bool HasHyperlinkData { get; }

HasSixelData

Gets whether this cell has associated Sixel data.

Returns: Boolean

csharp
public bool HasSixelData { get; }

HyperlinkData

Gets the hyperlink data if this cell has any, otherwise null.

Returns: HyperlinkData

csharp
public HyperlinkData? HyperlinkData { get; }

Gets whether this cell has blinking text.

Returns: Boolean

csharp
public bool IsBlink { get; }

IsBold

Gets whether this cell has bold text.

Returns: Boolean

csharp
public bool IsBold { get; }

IsDim

Gets whether this cell has dim/faint text.

Returns: Boolean

csharp
public bool IsDim { get; }

IsHidden

Gets whether this cell has hidden/invisible text.

Returns: Boolean

csharp
public bool IsHidden { get; }

IsItalic

Gets whether this cell has italic text.

Returns: Boolean

csharp
public bool IsItalic { get; }

IsOverline

Gets whether this cell has overlined text.

Returns: Boolean

csharp
public bool IsOverline { get; }

IsReverse

Gets whether this cell has reverse video (inverted colors).

Returns: Boolean

csharp
public bool IsReverse { get; }

IsSixel

Gets whether this cell contains Sixel graphics.

Returns: Boolean

csharp
public bool IsSixel { get; }

IsSoftWrap

Gets whether this cell is a soft-wrap point (content continues on the next row).

Returns: Boolean

csharp
public bool IsSoftWrap { get; }

IsStrikethrough

Gets whether this cell has strikethrough text.

Returns: Boolean

csharp
public bool IsStrikethrough { get; }

IsUnderline

Gets whether this cell has underlined text.

Returns: Boolean

csharp
public bool IsUnderline { get; }

Sequence

The write order of this cell. Higher values were written later. Used for z-ordering during rendering.

Returns: Int64

csharp
public long Sequence { get; init; }

SixelData

Gets the Sixel data if this cell has any, otherwise null.

Returns: SixelData

csharp
public SixelData? SixelData { get; }

Optional tracked reference to hyperlink data associated with this cell.

Returns: TrackedObject<HyperlinkData>

csharp
public TrackedObject<HyperlinkData>? TrackedHyperlink { get; init; }

TrackedSixel

Optional tracked reference to Sixel graphics data associated with this cell.

Returns: TrackedObject<SixelData>

csharp
public TrackedObject<SixelData>? TrackedSixel { get; init; }

UnderlineColor

The underline color (SGR 58), or null to use the foreground color.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? UnderlineColor { get; init; }

UnderlineStyle

The underline style (SGR 4:x). Defaults to .

Returns: UnderlineStyle

csharp
public UnderlineStyle UnderlineStyle { get; init; }

WrittenAt

The timestamp when this cell was written. Useful for debugging and future animation features.

Returns: DateTimeOffset

csharp
public DateTimeOffset WrittenAt { get; init; }

Fields

Empty

An empty cell with default attributes.

Returns: TerminalCell

csharp
public static readonly TerminalCell Empty

Released under the MIT License.