Style
ConsoleMonster.Styling
Foreground, background and decorations for a run of text or a cell. Immutable.
Inheritance
- ValueType
- Style
Usage
Explore 43 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 18
- Property Cell.Style
- Method RenderContext.Series
- Method RenderContext.Style
- Method HighlightStyles.For
- Method ChartPlot.SeriesStyle
- Method ITheme.Resolve
- Method Style.Combine
- Method Style.Downsample
- Method Style.With
- Method Style.WithBackgroundColor
- Method Style.WithColor
- Method Style.WithLink
- Method Style.Without
- Property Style.Plain
- Method Theme.Resolve
- Method ThemeStyle.Resolve
- Property TextSpan.Style
- Method LogTags.Style
Accepted by parameters 25
- Constructor Cell.Cell
- Method CellBuffer.Clear
- Method CellBuffer.Set
- Method CellBuffer.SetStyle
- Method CellBuffer.Write
- Method Region.Fill
- Method Region.HorizontalLine
- Method Region.Put
- Method Region.SetStyle
- Method Region.VerticalLine
- Method Region.Write
- Method Region.Write
- Method ITheme.TryResolve
- Method Style.Combine
- Method Style.Equals
- Method Style.op_Equality
- Method Style.op_Equality
- Method Style.op_Inequality
- Method Style.op_Inequality
- Method Theme.TryResolve
- Method Markup.TryParseStyle
- Method StyledLine.From
- Method StyledLine.WithBaseStyle
- Method StyledText.FromPlain
- Constructor TextSpan.TextSpan
Constructors
public Style(Color color, Color backgroundColor = default, TextDecoration decoration = None, string? link = null) #Creates a style.
Parameters
- color ConsoleMonster.Styling.Color
- Foreground colour.
- backgroundColor ConsoleMonster.Styling.Color = default
- Background colour.
- decoration ConsoleMonster.Styling.TextDecoration = None
- Decorations.
- link string? = null
- A hyperlink target (OSC 8), or null.
Methods
public Style Combine(Style overlay) #Layers overlay on top of this style: non-default overlay colours win and decorations are combined.
Parameters
- overlay ConsoleMonster.Styling.Style
- The style on top.
public Style Downsample(ColorDepth depth) #Downsamples both colours to the given depth; colours and decorations are dropped for ColorDepth.None, while a hyperlink target is kept, so plain output can still show it.
Parameters
- depth ConsoleMonster.Capabilities.ColorDepth
- The colour depth.
public bool Equals(Style other) #Indicates whether the current object is equal to another object of the same type.
Parameters
- other ConsoleMonster.Styling.Style
- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.public override bool Equals(object? obj) #Indicates whether this instance and a specified object are equal.
Parameters
- obj object?
- The object to compare with the current instance.
Returns
bool true if obj and this instance are the same type and represent the same value; otherwise, false.public override int GetHashCode() #Returns the hash code for this instance.
Returns
int A 32-bit signed integer that is the hash code for this instance.public static bool op_Equality(Style left, Style right) #Equality operator.
Parameters
- left ConsoleMonster.Styling.Style
- Left.
- right ConsoleMonster.Styling.Style
- Right.
Returns
bool Whether equal.public static bool op_Inequality(Style left, Style right) #Inequality operator.
Parameters
- left ConsoleMonster.Styling.Style
- Left.
- right ConsoleMonster.Styling.Style
- Right.
Returns
bool Whether different.public override string ToString() #Returns the fully qualified type name of this instance.
Returns
string The fully qualified type name.public Style With(TextDecoration decoration) #Returns a copy with extra decorations added.
Parameters
- decoration ConsoleMonster.Styling.TextDecoration
- Decorations to add.
public Style WithBackgroundColor(Color color) #Returns a copy with a different background.
Parameters
- color ConsoleMonster.Styling.Color
- The colour.
public Style WithColor(Color color) #Returns a copy with a different foreground.
Parameters
- color ConsoleMonster.Styling.Color
- The colour.
public Style WithLink(string? link) #Returns a copy with a hyperlink target (null removes it).
Parameters
- link string?
- The target URL.
public Style Without(TextDecoration decoration) #Returns a copy with decorations removed.
Parameters
- decoration ConsoleMonster.Styling.TextDecoration
- Decorations to remove.