PresenterContext
ConsoleMonster.Presenters
Everything a presenter may depend on, so output is deterministic for a given culture, clock and terminal.
Inheritance
- object
- PresenterContext
Usage
Explore 25 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 22
- Method AutoPresenter.Present
- Method BooleanPresenter.Present
- Method BytesPresenter.Present
- Method CellPresenters.Present
- Method ChipPresenter.Present
- Method DataBarPresenter.Present
- Method DatePresenter.Present
- Method DnsNamePresenter.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 int DecimalsNeeded(object? value) #The 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 object?
- The raw value.
Returns
int 0, 1 or 2; 0 for non-numbers.public PresenterContext WithColumn(double? maximum, int? decimals) #Returns a copy with column statistics: the largest value and the decimals the column's numbers share.
Parameters
- maximum double?
- The maximum, or null.
- decimals int?
- The shared decimals, or null.
public PresenterContext WithColumnMaximum(double? maximum) #Returns a copy with a column maximum.
Parameters
- maximum double?
- The maximum.
Inherited Methods
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 int? 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 bool HasColor { get; } #Whether the output can carry colour; without it, tones are expressed with symbols and words.
public bool Hyperlinks { get; } #Whether the terminal profile permits OSC 8 hyperlinks. Elsewhere links are shown as text, with the address when it differs from the text.