xtd.console - Reference Guide  0.0.1
Modern c++17 library to manage terminal on Windows, macOS and Linux.

§ foreground_color() [1/2]

template<class Char >
static console_color xtd::basic_console< Char >::foreground_color ( )
inlinestaticnoexcept

Gets the foreground color of the console.

Returns
A console_color that specifies the foreground color of the console; that is, the color of each character that is displayed.
Example
The following example saves the values of the console_color enumeration to an array and stores the current values of the background_color and foreground_color properties to variables. It then changes the foreground color to each color in the ConsoleColor enumeration except to the color that matches the current background, and it changes the background color to each color in the console_color enumeration except to the color that matches the current foreground. (If the foreground color is the same as the background color, the text isn't visible.) Finally, it calls the reset_color method to restore the original console colors.