See the following image from the output of a 24-bit color ANSI library for .NET Core I'm writing. I would like to improve the DrawBox function, which draws the rectangular outlines to gradient boxes to retain the underlaying background color attribute from the screen buffer as a new character is written.
ReadConsoleOutput lets me get the screen buffer at a certain location, but CHAR_INFO gets attributes that reflect the standard 16-color version. Is there a way to get the 24-bit color of the foreground and background attribute of a character at a certain screen buffer location?
https://learn.microsoft.com/en-us/windows/console/readconsoleoutput
https://learn.microsoft.com/en-us/windows/console/char-info-str