Skip to content
ConsoleMonster

API Reference

Class

ConsoleColorMap

Namespace ConsoleMonster.Styling
Assembly ConsoleMonster
Modifiers sealed

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, Boolean enabled = true) #

Creates a map for a render context.

Parameters

context ConsoleMonster.Canvas.RenderContext requiredposition: 0
The context the cells were rendered with.
enabled System.Boolean = true optionalposition: 1
False when colour is off (NO_COLOR, CONSOLEMONSTER_COLOR=none, plain mode).

Methods

public ConsoleColor? Background(Color color) #
Returns: ConsoleColor?

The host colour for a cell background, or null for the host's default.

Parameters

color ConsoleMonster.Styling.Color requiredposition: 0
The cell colour.

Returns

The console colour, or null.

public static Boolean ColorDisabled(TerminalProfile profile) #
Returns: Boolean

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 requiredposition: 0
The detected profile.

Returns

True when host output must stay uncoloured.

public ConsoleColor? Foreground(Color color) #
Returns: ConsoleColor?

The host colour for a cell foreground, or null for the host's default.

Parameters

color ConsoleMonster.Styling.Color requiredposition: 0
The cell colour.

Returns

The console colour, or null.

Properties

public Boolean Enabled { get; } #

Whether colours are mapped at all.