API Reference
PresenterContext
Everything a presenter may depend on, so output is deterministic for a given culture, clock and terminal.
Inheritance
- Object
- PresenterContext
Usage
Explore 23 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 3
Accepted by parameters 20
- Method AutoPresenter.Present
- Method BooleanPresenter.Present
- Method BytesPresenter.Present
- Method CellPresenters.Present
- Method DataBarPresenter.Present
- Method DatePresenter.Present
- Method DurationPresenter.Present
- Method EmojiPresenter.Present
- Method HighlightPresenter.Present
- Method ICellPresenter.Present
- Method IdentifierPresenter.Present
- Method LinkPresenter.Present
- Method MarkupPresenter.Present
- Method NumberPresenter.Present
- Method PresenterValues.Dash
- Method ProgressPresenter.Present
- Method SparklinePresenter.Present
- Method StatusEnumPresenter.Present
- Method StatusPresenter.Present
- Method TextPresenter.Present
Constructors
public PresenterContext(RenderContext render, CultureInfo? culture = null, DateTimeOffset? now = null, TimeZoneInfo? timeZone = null) #Creates a presenter context.
Parameters
- render ConsoleMonster.Canvas.RenderContext
- The render context (profile, theme, glyphs).
- culture System.Globalization.CultureInfo? = null
- The culture for numbers and dates, or null for the render culture (RenderContext.Culture).
- now System.DateTimeOffset? = null
- The reference time for relative dates, or null for the current time.
- timeZone System.TimeZoneInfo? = null
- The time zone for absolute dates, or null for local time.
Methods
public static Int32 DecimalsNeeded(Object? value) #Int32The decimals a number needs once rounded to two: 0 for whole numbers, 1 for 11.7, 2 for 3.14159 (numeric text such as "1.5" counts by its digits). Integer types, and numbers too large to carry fractions, need none.
Parameters
- value System.Object?
- The raw value.
Returns
0, 1 or 2; 0 for non-numbers.
public PresenterContext WithColumn(Double? maximum, Int32? decimals) #PresenterContextReturns a copy with column statistics: the largest value and the decimals the column's numbers share.
Parameters
- maximum System.Double?
- The maximum, or null.
- decimals System.Int32?
- The shared decimals, or null.
Returns
The copy.
public PresenterContext WithColumnMaximum(Double? maximum) #PresenterContextReturns a copy with a column maximum.
Parameters
- maximum System.Double?
- The maximum.
Returns
The copy.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public CultureInfo Culture { get; } #The culture for numbers (thousand separators, decimals) and dates.
public TimeZoneInfo TimeZone { get; } #The time zone absolute dates are shown in.
public Double? ColumnMaximum { get; set; } #The largest numeric value in the column (data bars scale to it), or null.
public Int32? ColumnDecimals { get; set; } #The decimals every number in the column is shown with (the most any of its values needs, at most two), so the decimal separators line up; null outside a column, where each number shows up to two decimals of its own.
public Boolean HasColor { get; } #Whether the output can carry colour; without it, tones are expressed with symbols and words.
public Boolean Hyperlinks { get; } #Whether OSC 8 hyperlinks can be emitted: interactive VT output on a terminal known to support them (Windows Terminal, VS Code). Elsewhere links are shown as text, with the address when it differs from the text.