ConsoleColorMap
ConsoleMonster.Styling
Maps rendered cell colours to the 16 ConsoleColor values a console API or a PowerShell host can show (Console.ForegroundColor, Write-Host -ForegroundColor). Theme roles map by meaning (pass green, fail red, warn yellow, muted dark grey, accent cyan; darker variants on the light theme), plain text keeps the host's own colour, and anything else falls back to the nearest of the 16 colours.
Inheritance
- object
- ConsoleColorMap
Constructors
public ConsoleColorMap(RenderContext context, bool enabled = true) #Creates a map for a render context.
Parameters
- context ConsoleMonster.Canvas.RenderContext
- The context the cells were rendered with.
- enabled bool = true
- False when colour is off (NO_COLOR, CONSOLEMONSTER_COLOR=none, plain mode).
Methods
public ConsoleColor? Background(Color color) #The host colour for a cell background, or null for the host's default.
Parameters
- color ConsoleMonster.Styling.Color
- The cell colour.
Returns
ConsoleColor? The console colour, or null.public static bool ColorDisabled(TerminalProfile profile) #Whether colour is off for host output: NO_COLOR (unless CONSOLEMONSTER_COLOR names a depth), CONSOLEMONSTER_COLOR=none, or plain mode.
Parameters
- profile ConsoleMonster.Capabilities.TerminalProfile
- The detected profile.
Returns
bool True when host output must stay uncoloured.public ConsoleColor? Foreground(Color color) #The host colour for a cell foreground, or null for the host's default.
Parameters
- color ConsoleMonster.Styling.Color
- The cell colour.
Returns
ConsoleColor? The console colour, or null.