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
GlyphRuneThe character or unicode symbol to display (e.g., '#', '·', '@', '╬')
ForegroundColorThe foreground color for the glyph
BackgroundColor?Optional background color (null for transparent)
StyleTextStyleText styling flags (bold, underline, etc.)
Properties
Background
Optional background color (null for transparent)
public Color? Background { get; init; }
Property Value
Foreground
The foreground color for the glyph
public Color Foreground { get; init; }
Property Value
Glyph
The character or unicode symbol to display (e.g., '#', '·', '@', '╬')
public Rune Glyph { get; init; }
Property Value
Style
Text styling flags (bold, underline, etc.)
public TextStyle Style { get; init; }
Property Value
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
chcharCharacter to display
fgColorForeground color
bgColor?Optional background color
styleTextStyleOptional 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
bgColor?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
fgColorThe 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
gRuneThe 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
sTextStyleThe new text style flags
Returns
- TileVisual
A new TileVisual with the specified style