I have an extremely simple Console application written in C#. It is very easy to change the background and foreground colors when printing text, but I am wondering if there is an easy way to determine the background and foreground colors at a particular position.
It’s not an essential feature, so I’m not interested in P-Invoke, etc. If it can’t be done in 1 minute, then I’ll just leave it.
EDIT
I’m looking for something like
Console.GetBackground(0,0);
I don’t see anything like that in the MSDN documentation, but I’m hoping I may have missed something simple.
There is no built-in feature in .NET capable of providing the foreground and background colors previously used at an arbitrary location in the console.
Kudos to offlinehacker for the comment providing a link to the Windows API documentation. While it’s possible this could have provided a solution, the implementation was too complicated for me. (I abandoned the effort, but I may try again if the cost-benefit ratio changes.)