Does anyone know how I would set the color of a string that will be printed using System.out
?
This is the code I currently have:
System.out.println("TEXT THAT NEEDS TO BE A DIFFERENT COLOR.");
Does anyone know how I would set the color of a string that will be printed using System.out
?
This is the code I currently have:
System.out.println("TEXT THAT NEEDS TO BE A DIFFERENT COLOR.");
Download jansi-1.4.jar and Set classpath and Try This code 100% working :
If you're printing to stdout, it depends on the terminal you're printing to. You can use ansi escape codes on xterms and other similar terminal emulators. Here's a bash code snippet that will print all 255 colors supported by xterm, putty and Konsole:
You can use these escape codes in any programming language. It's better to rely on a library that will decide which codes to use depending on architecture and the content of the TERM environment variable.