Is way to get more colours in windows console (c )? by "more" i mean RGB colours, i have tried:
CONSOLE_SCREEN_BUFFER_INFOEX info;
info.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfoEx(hcon, &info);
info.ColorTable[0] = 0x505050;
info.ColorTable[1] = 0xcccccc;
SetConsoleScreenBufferInfoEx(hcon, &info);
SetConsoleTextAttribute(hcon, 01);
but i can use only 16 colours in one time
CodePudding user response:
From some of the documentation on the console API, specifically relating to Virtual Terminal Sequences for Extended Color:
Some virtual terminal emulators support a palette of colors greater than the 16 colors provided by the Windows Console. For these extended colors, the Windows Console will choose the nearest appropriate color from the existing 16 color table for display.
Based on this, I'd make the assumption that the Windows Console doesn't support anything more than 16 colors. If I had to guess, this is a backwards-compatibility restriction to interact with programs that assumed there were only ever 16 colors.
If you want more, you'd be best served by not using the Windows Console. If that's not possible, then you're stuck with 16 total.