Skip to content
ConsoleMonster
Class

TerminalEnvironment

ConsoleMonster.Capabilities

Namespace
ConsoleMonster.Capabilities
Assembly
ConsoleMonster
Modifiers
sealed

An immutable snapshot of the process inputs used by capability detection.

Inheritance

  • object
  • TerminalEnvironment

Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Accepted by parameters 1

Constructors

public TerminalEnvironment(IReadOnlyDictionary<string, string>? environmentVariables = null, bool isOutputRedirected = false, bool isWindows = false, int windowsBuild = 0, bool isConsoleHandle = false, bool? virtualTerminalEnabled = null, string? consoleFontFace = null, bool consoleFontIsRaster = false, int windowWidth = 0, int windowHeight = 0, bool isInputRedirected = false) #

Creates a snapshot, copying variables with the platform's name comparison.

Parameters

environmentVariables System.Collections.Generic.IReadOnlyDictionary<string, string>? = null optional
Environment variables; absent entries behave as empty strings.
isOutputRedirected bool = false optional
Whether stdout is redirected.
isWindows bool = false optional
Whether the host is Windows.
windowsBuild int = 0 optional
Windows build number, or zero when unknown.
isConsoleHandle bool = false optional
Whether GetConsoleMode succeeded for stdout.
virtualTerminalEnabled bool? = null optional
Result of enabling VT, or null when not attempted.
consoleFontFace string? = null optional
Console font face, if available.
consoleFontIsRaster bool = false optional
Whether the font is raster.
windowWidth int = 0 optional
Visible columns, or zero when unavailable.
windowHeight int = 0 optional
Visible rows, or zero when unavailable.
isInputRedirected bool = false optional
Whether standard input is redirected.

Methods

public static TerminalEnvironment Capture() #

Captures real process inputs, enabling Windows VT output without changing code pages.

Returns

TerminalEnvironment A snapshot for deterministic detection.

Properties

public IReadOnlyDictionary<string, string> EnvironmentVariables { get; } #

Copied environment variables, case-insensitive on Windows.

public bool IsOutputRedirected { get; } #

Whether stdout is redirected.

public bool IsWindows { get; } #

Whether the host is Windows.

public int WindowsBuild { get; } #

Windows build, or zero when unknown.

public bool IsConsoleHandle { get; } #

Whether GetConsoleMode succeeded for stdout.

public bool? VirtualTerminalEnabled { get; } #

Result of enabling VT, or null when not attempted.

public string? ConsoleFontFace { get; } #

Console font face, when available.

public bool ConsoleFontIsRaster { get; } #

Whether the console font is raster.

public int WindowWidth { get; } #

Visible columns, or zero when unavailable.

public int WindowHeight { get; } #

Visible rows, or zero when unavailable.

public bool IsInputRedirected { get; } #

Whether standard input is redirected.

public bool HighContrast { get; } #

Whether the Windows system High Contrast setting is enabled in this snapshot.