HighlightStyles
ConsoleMonster.Highlighting
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) #The style of a role.
Parameters
- role ConsoleMonster.Highlighting.HighlightRole
- The role.
- context ConsoleMonster.Canvas.RenderContext
- The render context.
public static List<StyledLine> ToLines(string text, ITextHighlighter? highlighter, RenderContext context, int maxLines = 0) #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 string
- The text.
- highlighter ConsoleMonster.Highlighting.ITextHighlighter?
- The highlighter, or null for plain text.
- context ConsoleMonster.Canvas.RenderContext
- The render context.
- maxLines int = 0
- The most lines to return (0 for all).
public static List<StyledLine> ToLines(string text, ITextHighlighter? highlighter, RenderContext context, int maxLines, ThemeToken? typeTone) #Highlights literal lines with an optional tone override for type tokens.
Parameters
- text string
- The literal source text.
- highlighter ConsoleMonster.Highlighting.ITextHighlighter?
- The language highlighter, or null for plain text.
- context ConsoleMonster.Canvas.RenderContext
- The theme and terminal context.
- maxLines int
- The line limit, or zero for every line.
- typeTone ConsoleMonster.Styling.ThemeToken?
- The type-token tone, or null for the language default.
public static string ToMarkup(string text, ITextHighlighter highlighter) #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 string
- The text.
- highlighter ConsoleMonster.Highlighting.ITextHighlighter
- The highlighter.
Returns
string The markup.