Skip to content
ConsoleMonster

API Reference

Class

ConsoleTextLayout

Namespace ConsoleMonster.Text
Assembly ConsoleMonster
Modifiers sealed

Lays out console text the way Write-Color does, for Write-ConsoleText and C# hosts alike: empty lines before and after, a prefix of tabs, spaces and an optional time stamp on the first line, text split at a separator with the following parts aligned under the text, wrapping that continues under the text, padding (left, right or centred, measured in terminal cells) and centring in the window.

Inheritance

  • Object
  • ConsoleTextLayout

Constructors

public ConsoleTextLayout() #

Methods

public IReadOnlyList<StyledLine> Lines(RichText text, RenderContext context, Int32 width) #
Returns: IReadOnlyList<StyledLine>

The lines of a text at a width.

Parameters

text ConsoleMonster.Text.RichText requiredposition: 0
The text.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
The render context.
width System.Int32 requiredposition: 2
The width for wrapping and centring.

Returns

The lines.

public IReadOnlyList<RichText> Parts(RichText text) #
Returns: IReadOnlyList<RichText>

The parts of a text after ConsoleTextLayout.SplitLines.

Parameters

text ConsoleMonster.Text.RichText requiredposition: 0
The text.

Returns

The parts (one when there is no separator).

Properties

public Int32 StartTab { get; set; } #

Tabs before the text (eight cells each).

public Int32 StartSpaces { get; set; } #

Spaces before the text.

public Int32 LinesBefore { get; set; } #

Empty lines before the text.

public Int32 LinesAfter { get; set; } #

Empty lines after the text.

public DateTime? Time { get; set; } #

The time shown in brackets at the start, or null for none.

public String TimeFormat { get; set; } #

The time format (default yyyy-MM-dd HH:mm:ss).

public String? SplitLines { get; set; } #

A separator the text is split at; the following parts are aligned under the first, after the prefix.

public Boolean Wrap { get; set; } #

Wraps long text at the width, continuing under the text after the prefix.

public Boolean HorizontalCenter { get; set; } #

Centres each line in the width.

public Int32 PadLeft { get; set; } #

Pads each line on the left to this many cells (right-aligned).

public Int32 PadRight { get; set; } #

Pads each line on the right to this many cells.

public Int32 PadCenter { get; set; } #

Centres each line within this many cells.

public Char PadCharacter { get; set; } #

The padding character (default a space).