1

In .NET, I can use the Console class to change the color index (effectively 0-15) for the foreground and background colors of the console via Console.BackGroundColor and Console.ForegroundColor respectively. Both of these properties then use the Win32 SetConsoleTextAttribute function to affect the change.

I can also use the ScreenColors and PopupColors keys in the registry, beneath HKEY_CURRENT_USER\Console to change the background and foreground indexes for both the normal and popup foreground and background colors for the default console properties.

What I can't find is any means of changing the popup color indexes for the current console, either in the Console .NET class, nor in the Win32 console APIs.

Does such an API exist, and if so, which one is it?

David Arno
  • 42,717
  • 16
  • 86
  • 131
  • If you have Windows 10 TH2 or later you can just use standard ANSI escape codes: https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences – Dave M Mar 14 '18 at 23:33
  • Actually reading your question more carefully, not sure if that will work for popup colors – Dave M Mar 14 '18 at 23:36
  • Possible undocumented Win API http://www.catch22.net/sites/default/source/files/setconsoleinfo.c – Stephen Kennedy Mar 14 '18 at 23:50
  • Google "c# setconsolescreenbufferinfoex" for hits. [This is one of them](https://stackoverflow.com/a/3219873/17034). – Hans Passant Mar 15 '18 at 00:23
  • Thanks for your feedback, all. It had indeed been staring me in the face re `SetConsoleScreenBufferInfoEx()` and I'd completely missed it. – David Arno Mar 15 '18 at 15:00

0 Answers0