3

I'm trying to print colored text to eclipse console using ANSI Sequences (as described for example here: How to print color in console using System.out.println?).

I've tried multiple approaches, most recently a very implicit one:

public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_RED = "\u001B[31m";

System.out.println(ANSI_RED + "*" + ANSI_RESET);

but all I'm getting from console is:

enter image description here

Am I doing something wrong?

Thanks for your help!

MSH
  • 163
  • 1
  • 1
  • 17
  • If you are using Windows, it could not work in this way. – davidxxx Jun 03 '17 at 16:31
  • i'm not sure but i think this trick work with netbeans not with eclipse – Youcef LAIDANI Jun 03 '17 at 16:32
  • 2
    The standard Eclipse console does not support ANSI colors. There are some plugins that add this, see [this](https://stackoverflow.com/q/6286701/2670892) question – greg-449 Jun 03 '17 at 16:38
  • Install the "ANSI Escape in Console" plugin https://marketplace.eclipse.org/content/ansi-escape-console (from Eclipse Marketplace search for ANSI) – Mihai Nita Dec 21 '20 at 00:09

0 Answers0