In Windows, I want my program to output text to console to be red for only one line of the program. But, I want the background to remain unchanged no matter if the program ran from Powershell or cmd.
I have tried using HANDLE
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
cout << text;
This will change the background. If I match cmd's default black background (if color is 0-15), it displays the text with a black background in Powershell over Powershell's default dark blue background.
I would like it so if someone runs the program from either CMD or Powershell, the background color does not change but the text does change.