Home

Published

- 1 min read

colorful print statments in java

img of colorful print statments in java

The solution for this is noted below

colorful print statments in java

Solution

   import org.fusesource.jansi.Ansi;

System.out.println(Ansi.ansi().fg(Ansi.Color.RED).a("This text is red").reset());
// You can use Ansi.ansi().bg(Ansi.Color.RED) to change the background color and Ansi.ansi().a(Ansi.Attribute.BLINK) to make text blink.
// Many other color codes you can use, like Ansi.Color.GREEN, Ansi.Color.BLUE, Ansi.Color.YELLOW

Try other methods by searching on the site. That is if this doesn’t work