Skip to content
ConsoleMonster
Class

StyledText

ConsoleMonster.Text

Namespace
ConsoleMonster.Text
Assembly
ConsoleMonster
Modifiers
sealed

Multi-line styled text: the result of parsing markup or splitting plain text into lines.

Inheritance

  • object
  • StyledText

Usage

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

Constructors

public StyledText(IReadOnlyList<StyledLine> lines) #

Creates styled text from lines.

Parameters

lines System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.StyledLine> required
The lines.

Methods

public static StyledText FromPlain(string? text, Style style = default) #

Splits plain text (no markup) into lines with one style.

Parameters

text string? required
The text; \r\n, \n and \r separate lines.
style ConsoleMonster.Styling.Style = default optional
The style.

Returns

StyledText Styled text.
public static StyledText FromSpans(IEnumerable<TextSpan> spans) #

Creates styled text from spans that may contain line breaks.

Parameters

spans System.Collections.Generic.IEnumerable<ConsoleMonster.Text.TextSpan> required
The spans.

Returns

StyledText Styled text.

Properties

public IReadOnlyList<StyledLine> Lines { get; } #

The lines.

public int Width { get; } #

The widest line in cells.