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
RuneThe character or unicode symbol to display (e.g., '#', '·', '@', '╬')
Foreground
ColorThe foreground color for the glyph
Background
Color?Optional background color (null for transparent)
Style
TextStyleText 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
ch
charCharacter to display
fg
ColorForeground color
bg
Color?Optional background color
style
TextStyleOptional 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
ColorThe 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
RuneThe 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
TextStyleThe new text style flags
Returns
- TileVisual
A new TileVisual with the specified style