Table of Contents

Struct TileVisual

Namespace
Gloam.Core.Primitives
Assembly
Gloam.Core.dll

Represents a visual tile with glyph, colors, and text styling for tile-based rendering

public readonly record struct TileVisual : IEquatable<TileVisual>
Implements
Inherited Members

Constructors

TileVisual(Rune, Color, Color?, TextStyle)

Represents a visual tile with glyph, colors, and text styling for tile-based rendering

public TileVisual(Rune Glyph, Color Foreground, Color? Background = null, TextStyle Style = TextStyle.None)

Parameters

Glyph Rune

The character or unicode symbol to display (e.g., '#', '·', '@', '╬')

Foreground Color

The foreground color for the glyph

Background Color?

Optional background color (null for transparent)

Style TextStyle

Text styling flags (bold, underline, etc.)

Properties

Background

Optional background color (null for transparent)

public Color? Background { get; init; }

Property Value

Color?

Foreground

The foreground color for the glyph

public Color Foreground { get; init; }

Property Value

Color

Glyph

The character or unicode symbol to display (e.g., '#', '·', '@', '╬')

public Rune Glyph { get; init; }

Property Value

Rune

Style

Text styling flags (bold, underline, etc.)

public TextStyle Style { get; init; }

Property Value

TextStyle

Methods

FromChar(char, Color, Color?, TextStyle)

Creates a TileVisual from a character with specified colors and styling

public static TileVisual FromChar(char ch, Color fg, Color? bg = null, TextStyle style = TextStyle.None)

Parameters

ch char

Character to display

fg Color

Foreground color

bg Color?

Optional background color

style TextStyle

Optional text styling

Returns

TileVisual

A new TileVisual instance

WithBg(Color?)

Creates a copy of this TileVisual with a different background color

public TileVisual WithBg(Color? bg)

Parameters

bg Color?

The new background color (or null for transparent)

Returns

TileVisual

A new TileVisual with the specified background color

WithFg(Color)

Creates a copy of this TileVisual with a different foreground color

public TileVisual WithFg(Color fg)

Parameters

fg Color

The new foreground color

Returns

TileVisual

A new TileVisual with the specified foreground color

WithGlyph(Rune)

Creates a copy of this TileVisual with a different glyph

public TileVisual WithGlyph(Rune g)

Parameters

g Rune

The new glyph to use

Returns

TileVisual

A new TileVisual with the specified glyph

WithStyle(TextStyle)

Creates a copy of this TileVisual with different text styling

public TileVisual WithStyle(TextStyle s)

Parameters

s TextStyle

The new text style flags

Returns

TileVisual

A new TileVisual with the specified style