Terminal string styling done right (in java)
APACHE-2.0 License
Terminal string styling done right (in java)
Chalk is focusing on cross-platform standard output coloring in java.
The coloring should work:
I want java tools to have the same possibilities as javascript. npm and related tools nicely color output even on Windows; Java does not have this possibility. After looking at Chalk for javascript, I have decided to implement a similar solution in Java.
We are on maven central:
<dependency>
<groupId>com.github.tomas-langer</groupId>
<artifactId>chalk</artifactId>
<version>1.0.2</version>
</dependency>
Printing a highlighted text - underlined red:
System.out.println("This message is " + Chalk.on("IMPORTANT").red().underline());
will print:
There are some system properties to control behavior:
The following CI tools are currently recognized:
Only those supported at least on two of: Windows, Linux, Idea and Jenkins plugin are included.
bold
underline
(will use a different background on Windows, underlining not supported)
inverse
black
red
green
yellow
blue
(this color is illegible on Windows with black background)
magenta
cyan
white
gray
(just black on Windows - requires light background)
bgBlack
bgRed
bgGreen
bgYellow
bgBlue
bgMagenta
bgCyan
bgWhite