Name
FormatConsoleLine -- set style and color for several characters (V10.0)
Synopsis
FormatConsoleLine(n, style[, pen, fgcolor, bgcolor])
Library
console

Platforms
Linux, macOS, Windows

Function
This function sets the specified style and color for the next n characters on the current line without changing the existing text, or altering the existing style or color settings. Passing -1 for n means to apply the format to all characters until the end of the current line.

All console styles supported by the SetConsoleStyle() function can be passed in the style parameter. See SetConsoleStyle for details. If you don't want to modify any style settings, you can pass the special style #CONSOLESTYLE_NONE for style. In that case, FormatConsoleLine() won't apply any styles.

The optional parameters pen, fgcolor and bgcolor can be used to change the color of the characters. They can be used in the same way as with SetConsoleColor(). See SetConsoleColor for details.

You must enable advanced console mode using EnableAdvancedConsole() before you can use this function. See EnableAdvancedConsole for details.

Inputs
n
number of characters to format or -1 for all character in the current line
style
formatting style to apply or #CONSOLESTYLE_NONE to ignore the argument
pen
optional: color pen to use or 0 to reset text color to default (defaults to 0)
fgcolor
optional: desired foreground color for the pen; this must be either an RGB color from the list above or a color allocated by AllocConsoleColor() (defaults to #NOCOLOR)
bgcolor
optional: desired background color for the pen; this must be either an RGB color from the list above or a color allocated by AllocConsoleColor() (defaults to #NOCOLOR)

Show TOC