Skip to content
ConsoleMonster

API Reference

Class

ToneRule

Namespace ConsoleMonster.Presenters
Assembly ConsoleMonster
Modifiers sealed

A conditional formatting rule: when a value matches, the cell takes a tone (the first matching rule wins). Rules compare the presented number when there is one (numbers, bytes, durations in seconds, dates in days from now), so ToneRule.Below(30, ThemeToken.Warn) on a date column flags certificates expiring within 30 days. Without colour, a status tone (pass, warn, fail) adds its symbol in front of the value, so the rule stays visible.

Inheritance

  • Object
  • ToneRule

Usage

Explore 16 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 7

Constructors

public ToneRule(Func<Object?, Double?, Boolean> matches, ThemeToken tone) #

Creates a rule from a predicate over the raw value and the presented number (when there is one).

Parameters

matches System.Func<System.Object?, System.Double?, System.Boolean> requiredposition: 0
The predicate.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone to apply.

Methods

public static ToneRule Above(Double threshold, ThemeToken tone) #
Returns: ToneRule

Matches numbers greater than a threshold.

Parameters

threshold System.Double requiredposition: 0
The threshold.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

public static ToneRule AtLeast(Double threshold, ThemeToken tone) #
Returns: ToneRule

Matches numbers greater than or equal to a threshold.

Parameters

threshold System.Double requiredposition: 0
The threshold.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

public static ToneRule AtMost(Double threshold, ThemeToken tone) #
Returns: ToneRule

Matches numbers less than or equal to a threshold.

Parameters

threshold System.Double requiredposition: 0
The threshold.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

public static ToneRule Below(Double threshold, ThemeToken tone) #
Returns: ToneRule

Matches numbers less than a threshold.

Parameters

threshold System.Double requiredposition: 0
The threshold.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

public static ToneRule Equal(Object? expected, ThemeToken tone) #
Returns: ToneRule

Matches values equal to expected (text comparison, case-insensitive).

Parameters

expected System.Object? requiredposition: 0
The expected value.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

public Boolean Matches(Object? value, Double? number) #
Returns: Boolean

Whether the rule matches.

Parameters

value System.Object? requiredposition: 0
The raw value.
number System.Double? requiredposition: 1
The presented number, or null.

Returns

True on a match.

public static ToneRule When(Func<Object?, Boolean> predicate, ThemeToken tone) #
Returns: ToneRule

Matches values for which predicate returns true.

Parameters

predicate System.Func<System.Object?, System.Boolean> requiredposition: 0
The predicate over the raw value.
tone ConsoleMonster.Styling.ThemeToken requiredposition: 1
The tone.

Returns

The rule.

Properties

public ThemeToken Tone { get; } #

The tone applied on a match.