Skip to content
ConsoleMonster

API Reference

Class

RenderContext

Namespace ConsoleMonster.Canvas
Assembly ConsoleMonster
Modifiers sealed

Everything a widget needs besides its own state: the terminal profile, the theme, the glyph set and the animation clock. Resolved theme styles and parsed markup are cached per context.

Inheritance

  • Object
  • RenderContext

Usage

Explore 141 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 136

Constructors

public RenderContext(TerminalProfile profile, ITheme theme, IGlyphSet? glyphs = null, Int64 tick = 0, TimeSpan elapsed = default) #

Creates a context.

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile requiredposition: 0
The terminal profile.
theme ConsoleMonster.Styling.ITheme requiredposition: 1
The theme.
glyphs ConsoleMonster.Glyphs.IGlyphSet? = null optionalposition: 2
The glyph set; defaults to the built-in set for the profile's tier.
tick System.Int64 = 0 optionalposition: 3
Animation frame counter (spinners advance with it).
elapsed System.TimeSpan = default optionalposition: 4
Time since the session started (for clocks).

Methods

public StyledText Markup(String markup) #
Returns: StyledText

Parses markup with this context's theme and colour depth (cached).

Parameters

markup System.String requiredposition: 0
The markup.

Returns

The styled text.

public Style Series(Int32 index) #
Returns: Style

Returns the chart series style for an index (wraps after six).

Parameters

index System.Int32 requiredposition: 0
Zero-based series index.

Returns

The style.

Style 2 overloads
public Style Style(ThemeToken token) #
Returns: Style

Returns the resolved style of a theme token.

Parameters

token ConsoleMonster.Styling.ThemeToken requiredposition: 0
The token.

Returns

The style for the current colour depth.

public Style Style(StatusKind status) #
Returns: Style

Returns the style for a status.

Parameters

status ConsoleMonster.Styling.StatusKind requiredposition: 0
The status.

Returns

The style.

public RenderContext WithClock(Int64 tick, TimeSpan elapsed) #
Returns: RenderContext

Returns a context for the next animation frame, keeping the caches.

Parameters

tick System.Int64 requiredposition: 0
The new tick.
elapsed System.TimeSpan requiredposition: 1
The new elapsed time.

Returns

A context sharing profile, theme and glyphs.

Properties

public TerminalProfile Profile { get; } #

The terminal profile.

public ITheme Theme { get; } #

The theme.

public IGlyphSet Glyphs { get; } #

The glyph set.

public ColorDepth Depth { get; } #

The colour depth being rendered.

public Boolean HasColor { get; } #

Whether any colour is available.

public CultureInfo Culture { get; } #

The culture for numbers and dates: TerminalProfile.Culture, or the current culture when that is null.

public WidgetLabels Labels { get; } #

The built-in widget words for TerminalProfile.Language (or the default language).

public Int64 Tick { get; } #

Animation frame counter.

public TimeSpan Elapsed { get; } #

Time since the session started.

public String Ellipsis { get; } #

The ellipsis for this glyph tier.

Extension Methods

public static String Spinner(RenderContext context, Int64 offset = 0) #
Returns: String

The running symbol for this frame: the tier's spinner, advanced by the session's tick (offset so neighbouring rows do not spin in step), or the static running glyph when the tier has no spinner. Every widget that shows running work (lanes, phases, status lists, activities, spinners) uses this one.

Parameters

context ConsoleMonster.Canvas.RenderContext requiredposition: 0
The render context.
offset System.Int64 = 0 optionalposition: 1
A per-row offset.

Returns

The symbol.