2

I wrote this piece of code to make a blue background:

System.out.print("\u001B[44m" + "   ");

it works fine in IntelliJ, but here's the output in cmd:

?[44m

I'm using the latest version of windows 10

what should I do?

Mohammad Salehi
  • 162
  • 1
  • 8
  • Does this answer your question? How to enable ANSI escape sequences in win32 console https://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences – Joni Apr 03 '20 at 20:08
  • 1
    ANSI is version dependant and user configuration dependant. So the Windows technique is like this and works on all windows. https://winsourcecode.blogspot.com/2019/12/colourtext-changes-colour-of-text-to-be.html. In MSDos/Windows it has been depreciated since the 1980s - it has recently had a comeback. –  Apr 03 '20 at 21:17
  • I recommend also to use the [Windows Console API](https://learn.microsoft.com/en-us/windows/console/using-the-console). Good coded console applications using this API have full control over the console window which not only includes foreground and background text color (always define both on colored text output), but also size of the console window, used font, encoding, etc. But an application using the console API and changing attributes should first get the current console attributes on starting the application and restore them before exiting. – Mofi Apr 04 '20 at 18:35

0 Answers0