1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <windows.h>
// Windows console colors
enum class COLORS : int
{ BLACK = 0,
DARKBLUE = 1,
DARKGREEN = 2,
DARKCYAN = 3,
DARKRED = 4,
DARKMAGENTA = 5,
DARKYELLOW = 6,
WHITE = 7,
GREY = 8,
BLUE = 9,
GREEN = 10,
CYAN = 11,
RED = 12,
MAGENTA = 13,
YELLOW = 14,
LIGHTGREY = 15,
};
HANDLE m_handle;
// Get the handle for the Windows console
m_handle = GetStdHandle(STD_OUTPUT_HANDLE);
void setConsoleColor (COLORS bgColor, COLORS textColor)
{ SetConsoleTextAttribute (m_handle, ((int)textColor + ((int)bgColor * 16)));
}
|