How can I change the entire console's background color? I've tried SetConsoleTextAttribute
and it only changes the background color of new text.
I effectively want the entire console to turn red when a serious error arises.
Thanks to everyone who attempts to help.
Declaration: void setbkcolor(int color); setbkcolor function changes current background color e.g. setbkcolor(YELLLOW) changes the current background color to YELLOW. Remember that default drawing color is WHITE and background color is BLACK.
If you are going to write your program for Windows and you want to change color of text and/or background, use this: SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), attr); Where attr is a combination of values with | (bitwise OR operator), to choose whther you want to change foreground or background color.
To change the background color of text in Console, use the Console. BackgroundColor Property in C#.
Try something like:
system("color c2");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With