Name
GetConsoleColor -- get console color (V10.0)
Synopsis
pen, fgcolor, bgcolor = GetConsoleColor([cursor])
Library
console

Platforms
Linux, macOS, Windows

Function
This function returns the active color of the current console window. If the optional argument cursor is set to True, the color at the current cursor position will be returned. Otherwise the color of the current window will be returned.

GetConsoleColor() will return three values: The currently active pen and the current foreground and background colors.

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

Inputs
cursor
optional: True to get the color at the cursor position, False to get the color of the current window (defaults to False)
Results
pen
current color pen
fgcolor
current foreground color as an RGB color
bgcolor
current background color as an RGB color

Show TOC