Maven 3.5.0 introduces coloring in console output.
It's a cool feature, however I don't like some default color choices, for example intensive blue INFO looks too distracting.
Is it possible to customize colors somehow?
Turns out it is possible.
Maven uses several styles to format its output:
enum Style
{
DEBUG( "bold,cyan" ),
INFO( "bold,blue" ),
WARNING( "bold,yellow" ),
ERROR( "bold,red" ),
SUCCESS( "bold,green" ),
FAILURE( "bold,red" ),
STRONG( "bold" ),
MOJO( "green" ),
PROJECT( "cyan" );
...
}
You can override the default color of a style with the system property style.style_name
. For example to change the style of INFO from default blue to dark gray you pass
-Dstyle.info=bold,black
option to maven. It also can be specified with MAVEN_OPTS
environment variable in order not to type it on every maven invocation.
If you don't know which style is used in the particular part of output, you can match it by its default color.
The colors that can be used in a style are defined by jansi library:
public enum Color {
BLACK(0, "BLACK"),
RED(1, "RED"),
GREEN(2, "GREEN"),
YELLOW(3, "YELLOW"),
BLUE(4, "BLUE"),
MAGENTA(5, "MAGENTA"),
CYAN(6, "CYAN"),
WHITE(7, "WHITE"),
DEFAULT(9, "DEFAULT");
}
Seems that you can prefix color with bg
to specify the background color, and to make it intensive, you add bold
modifier, for example:
bold,white,bgcyan
— intensive white on cyan background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With