Thanks to Talent25, I made this function:
#include <Windows.h> bool GetColor(short &ret){ CONSOLE_SCREEN_BUFFER_INFO info; if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info)) return false; ret = info.wAttributes; return true; }
using it:
GetColor(CurrentColor);
CurrentColor is a variable for the output color number (background * 16 + primary color). The return value indicates that the action was successful.
source share