0

I am using jansi jar for ANSI color console output .Is there any alternative of this jar ??

final Ansi ansi = Ansi.ansi();
        System.out.print(ansi.a(Attribute.INTENSITY_BOLD));
        switch (msg.getType()) {
        case CALL:
            System.out.println(ansi.fg(Color.CYAN) + s);
            break;
        case RESP:
            System.out.println(ansi.fg(Color.GREEN) + s);
            break;
        case EVNT:
            System.out.println(ansi.fg(Color.WHITE) + s);
            break;
        case CTRL:
            System.out.println(ansi.fg(Color.YELLOW) + s);
            break;
        default:
        }
        System.out.print(ansi.reset()); 
  • please read [this answer](https://stackoverflow.com/a/51944613/9218757) for your question – Dang Nguyen Oct 31 '18 at 07:59
  • Possible duplicate of [How to print color in console using System.out.println?](https://stackoverflow.com/questions/5762491/how-to-print-color-in-console-using-system-out-println) – Dang Nguyen Oct 31 '18 at 08:00
  • Fine,but Is there any other 3rd party API which is having same functionality ? – Shubham Kumar Oct 31 '18 at 08:43

1 Answers1

0

Fine,but Is there any other 3rd party API which is having same functionality ?

Yes, there are several options for you:

https://github.com/programingjd/ansi_colors
https://github.com/tomas-langer/chalk

You can have a look at those.

Dang Nguyen
  • 1,209
  • 1
  • 17
  • 29