Skip to content
ConsoleMonster

API Reference

Class

TerminalBackground

Namespace ConsoleMonster.Output
Assembly ConsoleMonster
Modifiers static

Detects terminal background appearance using output-side and environment information only.

Inheritance

  • Object
  • TerminalBackground

Methods

public static Double CalculateLuminance(Byte red, Byte green, Byte blue) #
Returns: Double

Calculates WCAG relative luminance from 8-bit sRGB channels.

Parameters

red System.Byte requiredposition: 0
green System.Byte requiredposition: 1
blue System.Byte requiredposition: 2
public static Int32 GetAttributeIndex(UInt16 attributes) #
Returns: Int32

Extracts the background palette index from console attributes.

Parameters

attributes System.UInt16 requiredposition: 0
public static Boolean TryDetect(out TerminalBackgroundInfo info) #
Returns: Boolean

Attempts to detect the terminal background without reading standard input.

Parameters

info ConsoleMonster.Output.TerminalBackgroundInfo requiredposition: 0
The detected background or an unknown result.

Returns

True when a background classification was available.

public static Boolean TryParseColorFgbg(String? value, out Boolean isLight) #
Returns: Boolean

Parses a COLORFGBG foreground/background value.

Parameters

value System.String? requiredposition: 0
A semicolon-separated foreground and background index.
isLight System.Boolean requiredposition: 1
Whether the valid background index denotes a light colour.

Returns

True when the background index was valid.