| 80 | uint32 gConsoleBGColor = 0; |
| 81 | |
| 82 | static bool GetConsoleColor(uint32& fgColor, uint32& bgColor) |
| 83 | { |
| 84 | #ifdef _WIN32 |
| 85 | static uint32 consoleColors[16] = { 0xff000000, 0xff000080, 0xff008000, 0xff008080, 0xff800000, 0xff800080, 0xff808000, 0xffc0c0c0, |
| 86 | 0xff808080, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff }; |
| 87 | |
| 88 | CONSOLE_SCREEN_BUFFER_INFO screenBuffInfo = { 0 }; |
| 89 | GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &screenBuffInfo); |
| 90 | fgColor = consoleColors[screenBuffInfo.wAttributes & 0xF]; |
| 91 | bgColor = consoleColors[(screenBuffInfo.wAttributes >> 4) & 0xF]; |
| 92 | return true; |
| 93 | #else |
| 94 | fgColor = 0xFF808080; |
| 95 | bgColor = 0xFF000000; |
| 96 | return false; |
| 97 | #endif |
| 98 | } |
| 99 | |
| 100 | static WORD GetColorCode(uint32 color) |
| 101 | { |