Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: ConsoleColoredString ColorSubstring(this string, int, ConsoleColor?, ConsoleColor?)

Declaration

public static ConsoleColoredString ColorSubstring(
    this string str,
    int index,
    ConsoleColor? foreground,
    ConsoleColor? background = null
)

Summary

Colors a range of characters beginning at a specified index within the specified string in a specified color.

Parameters

this stringstr The string to partially colour.
intindex The index at which to start colouring.
ConsoleColor?foreground The colour to assign to the characters starting from the character at index.
ConsoleColor?background The background color to assign to the range of characters.

Returns

A potentially colorful string.