API Reference
RichStyle
The style of a rich-text span: foreground and background (RichColor: explicit colours, PowerShell ConsoleColors or theme roles), decorations (bold, dim, italic, underline, strikethrough, invert) and an optional hyperlink. Colours are resolved and down-mapped per colour tier when the text is rendered.
Inheritance
- ValueType
- RichStyle
Usage
Explore 20 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 6
- Method RichStyle.With
- Method RichStyle.WithBackground
- Method RichStyle.WithForeground
- Method RichStyle.WithLink
- Property RichStyle.Plain
- Property RichSegment.Style
Accepted by parameters 14
- Method RichStyle.Equals
- Method RichStyle.op_Equality
- Method RichStyle.op_Equality
- Method RichStyle.op_Inequality
- Method RichStyle.op_Inequality
- Constructor RichSegment.RichSegment
- Method RichText.Append
- Method RichText.FromMarkup
- Method RichText.FromPieces
- Method RichText.Gradient
- Method RichText.Plain
- Method RichText.WithBaseStyle
- Method RichTextBuilder.Append
- Method RichTextBuilder.AppendLink
Constructors
public RichStyle(RichColor foreground = default, RichColor background = default, TextDecoration decoration = None, String? link = null) #Creates a style.
Parameters
- foreground ConsoleMonster.Styling.RichColor = default
- The foreground colour.
- background ConsoleMonster.Styling.RichColor = default
- The background colour.
- decoration ConsoleMonster.Styling.TextDecoration = None
- Decorations.
- link System.String? = null
- A hyperlink target (OSC 8 where supported), or null.
Methods
public Boolean Equals(RichStyle other) #BooleanIndicates whether the current object is equal to another object of the same type.
Parameters
- other ConsoleMonster.Styling.RichStyle
- 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(RichStyle left, RichStyle right) #BooleanEquality.
Parameters
- left ConsoleMonster.Styling.RichStyle
- Left.
- right ConsoleMonster.Styling.RichStyle
- Right.
Returns
True when equal.
public static Boolean op_Inequality(RichStyle left, RichStyle right) #BooleanInequality.
Parameters
- left ConsoleMonster.Styling.RichStyle
- Left.
- right ConsoleMonster.Styling.RichStyle
- Right.
Returns
True when different.
public String ToMarkup() #StringThe style as a markup tag body (bold lime on navy link=https://...), or empty when plain.
Returns
The specification.
public override String ToString() #StringReturns the fully qualified type name of this instance.
Returns
The fully qualified type name.
public static Boolean TryParseDecoration(String? text, out TextDecoration decoration) #BooleanParses decorations from names separated by commas or spaces: Bold, Dim, Italic, Underline, Strikethrough (Strike), Invert (Reverse), and None.
Parameters
- text System.String?
- The names.
- decoration ConsoleMonster.Styling.TextDecoration
- The decorations.
Returns
True when every name is known.
public RichStyle With(TextDecoration decoration) #RichStyleReturns a copy with added decorations.
Parameters
- decoration ConsoleMonster.Styling.TextDecoration
- The decorations.
Returns
The copy.
public RichStyle WithBackground(RichColor color) #RichStyleReturns a copy with another background.
Parameters
- color ConsoleMonster.Styling.RichColor
- The colour.
Returns
The copy.
public RichStyle WithForeground(RichColor color) #RichStyleReturns a copy with another foreground.
Parameters
- color ConsoleMonster.Styling.RichColor
- The colour.
Returns
The copy.
public RichStyle WithLink(String? link) #RichStyleReturns a copy with a hyperlink (null removes it).
Parameters
- link System.String?
- The target.
Returns
The copy.