API Reference
Style
Foreground, background and decorations for a run of text or a cell. Immutable.
Inheritance
- ValueType
- Style
Usage
Explore 44 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 17
- Property Cell.Style
- Method RenderContext.Series
- Method RenderContext.Style
- Method HighlightStyles.For
- Method ITheme.Resolve
- Method Style.Combine
- Method Style.Downsample
- Method Style.With
- Method Style.WithBackground
- Method Style.WithForeground
- Method Style.WithLink
- Method Style.Without
- Property Style.Plain
- Method Theme.Resolve
- Method ThemeStyle.Resolve
- Property TextSpan.Style
- Method LogTags.Style
Accepted by parameters 27
- 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 SgrEncoder.Append
- Method SgrEncoder.Encode
- 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 foreground, Color background = default, TextDecoration decoration = None, String? link = null) #Creates a style.
Parameters
- foreground ConsoleMonster.Styling.Color
- Foreground colour.
- background ConsoleMonster.Styling.Color = default
- Background colour.
- decoration ConsoleMonster.Styling.TextDecoration = None
- Decorations.
- link System.String? = null
- A hyperlink target (OSC 8), or null.
Methods
public Style Combine(Style overlay) #StyleLayers overlay on top of this style: non-default overlay colours win and decorations are combined.
Parameters
- overlay ConsoleMonster.Styling.Style
- The style on top.
Returns
The combined style.
public Style Downsample(ColorDepth depth) #StyleDownsamples both colours to the given depth; decorations are dropped for ColorDepth.None.
Parameters
- depth ConsoleMonster.Capabilities.ColorDepth
- The colour depth.
Returns
The downsampled style.
public Boolean Equals(Style other) #BooleanIndicates 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
true if the current object is equal to the other parameter; otherwise, false.
public override Boolean Equals(Object? obj) #BooleanIndicates whether this instance and a specified object are equal.
Parameters
- obj System.Object?
- The object to compare with the current instance.
Returns
true if obj and this instance are the same type and represent the same value; otherwise, false.
public override Int32 GetHashCode() #Int32Returns the hash code for this instance.
Returns
A 32-bit signed integer that is the hash code for this instance.
public static Boolean op_Equality(Style left, Style right) #BooleanEquality operator.
Parameters
- left ConsoleMonster.Styling.Style
- Left.
- right ConsoleMonster.Styling.Style
- Right.
Returns
Whether equal.
public static Boolean op_Inequality(Style left, Style right) #BooleanInequality operator.
Parameters
- left ConsoleMonster.Styling.Style
- Left.
- right ConsoleMonster.Styling.Style
- Right.
Returns
Whether different.
public override String ToString() #StringReturns the fully qualified type name of this instance.
Returns
The fully qualified type name.
public Style With(TextDecoration decoration) #StyleReturns a copy with extra decorations added.
Parameters
- decoration ConsoleMonster.Styling.TextDecoration
- Decorations to add.
Returns
A new style.
public Style WithBackground(Color color) #StyleReturns a copy with a different background.
Parameters
- color ConsoleMonster.Styling.Color
- The colour.
Returns
A new style.
public Style WithForeground(Color color) #StyleReturns a copy with a different foreground.
Parameters
- color ConsoleMonster.Styling.Color
- The colour.
Returns
A new style.
public Style WithLink(String? link) #StyleReturns a copy with a hyperlink target (null removes it).
Parameters
- link System.String?
- The target URL.
Returns
The new style.
public Style Without(TextDecoration decoration) #StyleReturns a copy with decorations removed.
Parameters
- decoration ConsoleMonster.Styling.TextDecoration
- Decorations to remove.
Returns
A new style.