Skip to content
ConsoleMonster

API Reference

Class

HighlightStyles

Namespace ConsoleMonster.Highlighting
Assembly ConsoleMonster
Modifiers static

Maps highlight roles to theme roles, so highlighted text follows the theme and the colour depth like every other widget: keywords Series5, strings Series2, numbers Series3, keys Series1, types and identifiers Series6, variables Accent2, comments Muted italic, punctuation Muted, links Accent underlined, levels and diff lines by status.

Inheritance

  • Object
  • HighlightStyles

Methods

public static Style For(HighlightRole role, RenderContext context) #
Returns: Style

The style of a role.

Parameters

role ConsoleMonster.Highlighting.HighlightRole requiredposition: 0
The role.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
The render context.

Returns

The style.

public static List<StyledLine> ToLines(String text, ITextHighlighter? highlighter, RenderContext context, Int32 maxLines = 0) #
Returns: List<StyledLine>

Highlighted text as styled lines: tokens take their role's style, the rest plain. The text is literal (never markup); tabs become spaces to the next multiple of four and other control characters are dropped.

Parameters

text System.String requiredposition: 0
The text.
highlighter ConsoleMonster.Highlighting.ITextHighlighter? requiredposition: 1
The highlighter, or null for plain text.
context ConsoleMonster.Canvas.RenderContext requiredposition: 2
The render context.
maxLines System.Int32 = 0 optionalposition: 3
The most lines to return (0 for all).

Returns

The lines.

public static String ToMarkup(String text, ITextHighlighter highlighter) #
Returns: String

Highlighted text as markup with theme role names (for log regions and other markup sinks). The text is escaped, so nothing in it is read as markup; control characters other than line breaks are dropped.

Parameters

text System.String requiredposition: 0
The text.
highlighter ConsoleMonster.Highlighting.ITextHighlighter requiredposition: 1
The highlighter.

Returns

The markup.