Skip to content
ConsoleMonster

API Reference

Class

TerminalProfile

Namespace ConsoleMonster.Capabilities
Assembly ConsoleMonster
Modifiers sealed

An immutable description of what the current terminal can do. Produced by an ICapabilityProvider, overridable by code, environment variables (CONSOLEMONSTER_COLOR, CONSOLEMONSTER_GLYPHS, CONSOLEMONSTER_MODE, CONSOLEMONSTER_THEME, NO_COLOR) and configuration. Rendering is a pure function of the widget, its state, this profile and the theme.

Inheritance

  • Object
  • TerminalProfile

Usage

Explore 53 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.

Accepted by parameters 25

Constructors

public TerminalProfile(ColorDepth colorDepth, GlyphTier glyphs, OutputMode mode, Int32 width = 120, Int32 height = 40, TerminalKind kind = Unknown, Boolean supportsVirtualTerminal = false, Boolean isOutputRedirected = false, Boolean isConsoleHandle = false, Boolean isContinuousIntegration = false, String? fontFace = null, IReadOnlyList<String>? decisions = null, TerminalWidthProfile? widthProfile = null, Boolean probeWidths = false, ThemePreference themePreference = Auto, CultureInfo? culture = null) #

Creates a profile with explicit values. Tests and fixed-output scenarios use this directly.

Parameters

colorDepth ConsoleMonster.Capabilities.ColorDepth requiredposition: 0
Colour fidelity.
glyphs ConsoleMonster.Capabilities.GlyphTier requiredposition: 1
Glyph tier.
mode ConsoleMonster.Capabilities.OutputMode requiredposition: 2
Output mode.
width System.Int32 = 120 optionalposition: 3
Width in cells; values below 1 fall back to TerminalProfile.DefaultWidth.
height System.Int32 = 40 optionalposition: 4
Height in cells; values below 1 fall back to TerminalProfile.DefaultHeight.
kind ConsoleMonster.Capabilities.TerminalKind = Unknown optionalposition: 5
Detected terminal kind.
supportsVirtualTerminal System.Boolean = false optionalposition: 6
Whether VT sequences are understood.
isOutputRedirected System.Boolean = false optionalposition: 7
Whether standard output is redirected.
isConsoleHandle System.Boolean = false optionalposition: 8
Whether output goes to a real Windows console handle (written with WriteConsoleW).
isContinuousIntegration System.Boolean = false optionalposition: 9
Whether a CI environment was detected.
fontFace System.String? = null optionalposition: 10
The console font face, when known.
decisions System.Collections.Generic.IReadOnlyList<System.String>? = null optionalposition: 11
Human-readable notes explaining how each value was chosen.
widthProfile ConsoleMonster.Text.TerminalWidthProfile? = null optionalposition: 12
Configured or derived display width assumptions.
probeWidths System.Boolean = false optionalposition: 13
Whether a live width probe is permitted.
themePreference ConsoleMonster.Capabilities.ThemePreference = Auto optionalposition: 14
Requested terminal theme preference.
culture System.Globalization.CultureInfo? = null optionalposition: 15
The culture for numbers and dates in rendered output, or null for the current culture.

Methods

public static TerminalProfile Fixed(Int32 width, Int32 height, ColorDepth colorDepth = TrueColor, GlyphTier glyphs = Full, OutputMode mode = Interactive) #
Returns: TerminalProfile

A fixed profile for tests, snapshots and HTML-free documentation captures.

Parameters

width System.Int32 requiredposition: 0
Width in cells.
height System.Int32 requiredposition: 1
Height in cells.
colorDepth ConsoleMonster.Capabilities.ColorDepth = TrueColor optionalposition: 2
Colour fidelity.
glyphs ConsoleMonster.Capabilities.GlyphTier = Full optionalposition: 3
Glyph tier.
mode ConsoleMonster.Capabilities.OutputMode = Interactive optionalposition: 4
Output mode.

Returns

A profile with VT support when the mode is interactive.

public override String ToString() #
Returns: String

Returns a string that represents the current object.

Returns

A string that represents the current object.

public TerminalProfile WithColorDepth(ColorDepth colorDepth) #
Returns: TerminalProfile

Returns a copy with a different colour depth.

Parameters

colorDepth ConsoleMonster.Capabilities.ColorDepth requiredposition: 0
The new colour depth.

Returns

A new profile.

public TerminalProfile WithCulture(CultureInfo? culture) #
Returns: TerminalProfile

Returns a copy that renders numbers and dates with the given culture.

Parameters

culture System.Globalization.CultureInfo? requiredposition: 0
The culture, or null to follow the current culture.

Returns

The copy.

public TerminalProfile WithDecision(String decision) #
Returns: TerminalProfile

Returns a copy with an extra decision note appended.

Parameters

decision System.String requiredposition: 0
The note.

Returns

A new profile.

public TerminalProfile WithGlyphs(GlyphTier glyphs) #
Returns: TerminalProfile

Returns a copy with a different glyph tier.

Parameters

glyphs ConsoleMonster.Capabilities.GlyphTier requiredposition: 0
The new glyph tier.

Returns

A new profile.

public TerminalProfile WithLanguage(CultureInfo? language) #
Returns: TerminalProfile

Returns a copy whose built-in labels use the given language (see TerminalProfile.Language).

Parameters

language System.Globalization.CultureInfo? requiredposition: 0
The language, or null to follow the current UI culture.

Returns

The copy.

public TerminalProfile WithMode(OutputMode mode) #
Returns: TerminalProfile

Returns a copy with a different output mode.

Parameters

mode ConsoleMonster.Capabilities.OutputMode requiredposition: 0
The new mode.

Returns

A new profile.

public TerminalProfile WithSize(Int32 width, Int32 height) #
Returns: TerminalProfile

Returns a copy with a different size (used on resize).

Parameters

width System.Int32 requiredposition: 0
Width in cells.
height System.Int32 requiredposition: 1
Height in cells.

Returns

A new profile.

public TerminalProfile WithThemePreference(ThemePreference themePreference) #
Returns: TerminalProfile

Returns a copy with a different theme preference.

Parameters

themePreference ConsoleMonster.Capabilities.ThemePreference requiredposition: 0
The requested preference.

Returns

A new profile.

public TerminalProfile WithWidthProfile(TerminalWidthProfile profile) #
Returns: TerminalProfile

Returns a copy with a different terminal width profile.

Parameters

profile ConsoleMonster.Text.TerminalWidthProfile requiredposition: 0

Properties

public ColorDepth ColorDepth { get; } #

Colour fidelity.

public GlyphTier Glyphs { get; } #

Glyph tier.

public OutputMode Mode { get; } #

Output mode.

public Int32 Width { get; } #

Width in cells.

public Int32 Height { get; } #

Height in cells.

public TerminalKind Kind { get; } #

Detected terminal kind.

public Boolean SupportsVirtualTerminal { get; } #

Whether VT escape sequences are understood.

public Boolean IsOutputRedirected { get; } #

Whether standard output is redirected to a file, pipe or log.

public Boolean IsConsoleHandle { get; } #

Whether output goes to a real Windows console handle (UTF-16 through WriteConsoleW).

public Boolean IsContinuousIntegration { get; } #

Whether a CI environment was detected.

public String? FontFace { get; } #

The console font face, when known (conhost through GetCurrentConsoleFontEx).

public IReadOnlyList<String> Decisions { get; } #

Human-readable notes explaining how each value was chosen (shown by Get-ConsoleCapability).

public TerminalWidthProfile WidthProfile { get; } #

The configured or derived Unicode display width profile.

public Boolean ProbeWidths { get; } #

Whether an interactive session may probe terminal widths.

public ThemePreference ThemePreference { get; } #

The requested light, dark, or automatically detected theme preference.

public CultureInfo? Culture { get; } #

The culture for numbers and dates in rendered output (thousand and decimal separators, date formats), or null to follow the current culture at render time, as PowerShell does. Set by CONSOLEMONSTER_CULTURE or TerminalProfile.WithCulture. Built-in labels follow TerminalProfile.Language.

public CultureInfo? Language { get; private set; } #

The language of built-in labels (prompt keys, status words, "Showing 5 of 20"), or null for the current UI culture ($PSUICulture in PowerShell), unless CONSOLEMONSTER_LANGUAGE names one. English, Polish, German, Spanish, French and Italian are built in; other languages fall back to English. Set with TerminalProfile.WithLanguage.

public Boolean IsLive { get; } #

Whether the profile allows live redraw (interactive mode with VT support).

Fields

public const Int32 DefaultWidth #

The default width used when the real width cannot be determined (redirected output).

Value: 120
public const Int32 DefaultHeight #

The default height used when the real height cannot be determined.

Value: 40