3

I'm using a very nice Java text coloring library jansi which works perfectly when I run the my code from a DOS prompt or a LINUX terminal.

Unfortunately most of the time I find myself running code from my IntellIJ IDE (2019.3) and the console doesn't respect the ANSI coloring. Is there anyway round this? I did come across this question which discusses using the grep console plugin for this purpose, but this no longer works.

Is there any plugin or configuration settings that will allow me to use ANSI coloring and commands in the IntellIJ console?

Dan
  • 9,681
  • 14
  • 55
  • 70
  • 3
    It is [already natively supported](https://intellij-support.jetbrains.com/hc/en-us/community/posts/207125285-Intellij-14-console-not-respecting-ANSI-colors). Just tested in my IDE https://i.stack.imgur.com/bEeFM.png – Michael Jan 02 '20 at 15:50
  • 1
    Well this statement System.out.println("\u001B[31m" + "This text has red text but a default background!" + "\u001B[0m"); doesn't color in my console... – Dan Jan 02 '20 at 16:36
  • Which run configuration type are you using to run your code? – yole Jan 02 '20 at 18:23
  • Does https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006477540-Is-there-any-way-that-i-can-change-the-color-of-the-text-output-in-the-console-in-the-program- help? – CrazyCoder Jan 02 '20 at 19:47
  • No doesn't work for me - could be the the version of IntellIJ, my settings other plugins, possibly the color theme, other conflicting libraries - I guess it's a matter of a process of elimination. Good to know it's possible at least in theory.... – Dan Jan 03 '20 at 08:57

1 Answers1

1

From Intellij terminal you can simply run mvn install -Dstyle.color=always -Djansi.force=true

If you run Intellij's maven using command in Maven-panel, or execute it in your Run -> Edit Configurations

enter image description here

Then configure Intellij Maven settings like this:

https://i.imgur.com/WTiHJF4.png enter image description here

Zon
  • 18,610
  • 7
  • 91
  • 99