API Reference
TerminalProfile
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.
Returned or exposed by 28
- Property RenderContext.Profile
- Method CapabilityDetector.Detect
- Method CapabilityDetector.RefreshFont
- Method ICapabilityProvider.Detect
- Method TerminalProfile.Fixed
- Method TerminalProfile.WithColorDepth
- Method TerminalProfile.WithCulture
- Method TerminalProfile.WithDecision
- Method TerminalProfile.WithGlyphs
- Method TerminalProfile.WithLanguage
- Method TerminalProfile.WithMode
- Method TerminalProfile.WithSize
- Method TerminalProfile.WithThemePreference
- Method TerminalProfile.WithWidthProfile
- Property InteractiveOptions.Profile
- Property LiveSessionOptions.Profile
- Property ConsoleTarget.Profile
- Property ITerminalTarget.Profile
- Property NullTarget.Profile
- Property RecordingTarget.Profile
- Property WriterTarget.Profile
- Property InlineOutput.Profile
- Property ITerminalOutput.Profile
- Property LineOutput.Profile
- Property VtOutput.Profile
- Method Terminal.GetCurrentProfile
- Property Terminal.Profile
- Method TestTerminal.Profile
Accepted by parameters 25
- Constructor RenderContext.RenderContext
- Method CapabilityDetector.RefreshFont
- Constructor InlineArea.InlineArea
- Method InlineArea.IsSupported
- Constructor RecordingTarget.RecordingTarget
- Method StatusLine.Show
- Method TaskbarProgress.IsSupported
- Method TerminalWriterFactory.Create
- Constructor WriterTarget.WriterTarget
- Constructor InlineOutput.InlineOutput
- Constructor LineOutput.LineOutput
- Constructor VtOutput.VtOutput
- Method ConsoleColorMap.ColorDisabled
- Method Terminal.CreateContext
- Method Terminal.CreateInlineOutput
- Method Terminal.CreateOutput
- Method Terminal.Render
- Method Terminal.RenderEncoded
- Method Terminal.RenderText
- Method Terminal.ResolveTheme
- Method Terminal.Write
- Method Terminal.WriteLines
- Method Terminal.WriteMarkup
- Method Terminal.WriteMarkupLine
- Method Terminal.WriteRich
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
- Colour fidelity.
- glyphs ConsoleMonster.Capabilities.GlyphTier
- Glyph tier.
- mode ConsoleMonster.Capabilities.OutputMode
- Output mode.
- width System.Int32 = 120
- Width in cells; values below 1 fall back to TerminalProfile.DefaultWidth.
- height System.Int32 = 40
- Height in cells; values below 1 fall back to TerminalProfile.DefaultHeight.
- kind ConsoleMonster.Capabilities.TerminalKind = Unknown
- Detected terminal kind.
- supportsVirtualTerminal System.Boolean = false
- Whether VT sequences are understood.
- isOutputRedirected System.Boolean = false
- Whether standard output is redirected.
- isConsoleHandle System.Boolean = false
- Whether output goes to a real Windows console handle (written with WriteConsoleW).
- isContinuousIntegration System.Boolean = false
- Whether a CI environment was detected.
- fontFace System.String? = null
- The console font face, when known.
- decisions System.Collections.Generic.IReadOnlyList<System.String>? = null
- Human-readable notes explaining how each value was chosen.
- widthProfile ConsoleMonster.Text.TerminalWidthProfile? = null
- Configured or derived display width assumptions.
- probeWidths System.Boolean = false
- Whether a live width probe is permitted.
- themePreference ConsoleMonster.Capabilities.ThemePreference = Auto
- Requested terminal theme preference.
- culture System.Globalization.CultureInfo? = null
- 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) #TerminalProfileA fixed profile for tests, snapshots and HTML-free documentation captures.
Parameters
- width System.Int32
- Width in cells.
- height System.Int32
- Height in cells.
- colorDepth ConsoleMonster.Capabilities.ColorDepth = TrueColor
- Colour fidelity.
- glyphs ConsoleMonster.Capabilities.GlyphTier = Full
- Glyph tier.
- mode ConsoleMonster.Capabilities.OutputMode = Interactive
- Output mode.
Returns
A profile with VT support when the mode is interactive.
public override String ToString() #StringReturns a string that represents the current object.
Returns
A string that represents the current object.
public TerminalProfile WithColorDepth(ColorDepth colorDepth) #TerminalProfileReturns a copy with a different colour depth.
Parameters
- colorDepth ConsoleMonster.Capabilities.ColorDepth
- The new colour depth.
Returns
A new profile.
public TerminalProfile WithCulture(CultureInfo? culture) #TerminalProfileReturns a copy that renders numbers and dates with the given culture.
Parameters
- culture System.Globalization.CultureInfo?
- The culture, or null to follow the current culture.
Returns
The copy.
public TerminalProfile WithDecision(String decision) #TerminalProfileReturns a copy with an extra decision note appended.
Parameters
- decision System.String
- The note.
Returns
A new profile.
public TerminalProfile WithGlyphs(GlyphTier glyphs) #TerminalProfileReturns a copy with a different glyph tier.
Parameters
- glyphs ConsoleMonster.Capabilities.GlyphTier
- The new glyph tier.
Returns
A new profile.
public TerminalProfile WithLanguage(CultureInfo? language) #TerminalProfileReturns a copy whose built-in labels use the given language (see TerminalProfile.Language).
Parameters
- language System.Globalization.CultureInfo?
- The language, or null to follow the current UI culture.
Returns
The copy.
public TerminalProfile WithMode(OutputMode mode) #TerminalProfileReturns a copy with a different output mode.
Parameters
- mode ConsoleMonster.Capabilities.OutputMode
- The new mode.
Returns
A new profile.
public TerminalProfile WithSize(Int32 width, Int32 height) #TerminalProfileReturns a copy with a different size (used on resize).
Parameters
- width System.Int32
- Width in cells.
- height System.Int32
- Height in cells.
Returns
A new profile.
public TerminalProfile WithThemePreference(ThemePreference themePreference) #TerminalProfileReturns a copy with a different theme preference.
Parameters
- themePreference ConsoleMonster.Capabilities.ThemePreference
- The requested preference.
Returns
A new profile.
public TerminalProfile WithWidthProfile(TerminalWidthProfile profile) #TerminalProfileReturns a copy with a different terminal width profile.
Parameters
- profile ConsoleMonster.Text.TerminalWidthProfile
Inherited Methods
Properties
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).