I just learned that it's possible to color output in java console using ANSI escape sequences. The below for instance:
final String RED_COLOR_CODE = "\u001B[31m";
final String RESET_CODE = "\u001B[0m";
System.out.println(RED_COLOR_CODE + "This is red output" + RESET_CODE);
would print 'This is red output' to the console in red.
If I use a PrintStream to print exactly the same to a plain text file:
PrintStream ps = new PrintStream("foo/log.log");
ps.println(RED_COLOR_CODE + "This is red output" + RESET_CODE);
ps.close();
and then I open the file in Intellij editor I get ' [31mThis is red output [0m' in black. Is there a configuration or maybe a plugin for IntelliJ that would allow the rendering of ANSI escape sequences in the editor similarly to console?
It's not possible at the moment, vote for this related request:
See also this forum discussion.
For those interested, here's a plugin that should do while on the wait for official support by JetBrains.
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