Skip to content

Color customization

Jean-Christophe GAY edited this page Sep 18, 2015 · 3 revisions

If you're not fine with default color settings, you can roll your own in ~/.m2/maven.color with Groovy. You must extends com.github.jcgay.maven.color.core.CustomColorization and overwrite the part you're interested in.

import com.github.jcgay.maven.color.core.CustomColorization
import org.fusesource.jansi.Ansi

import static org.fusesource.jansi.Ansi.Color.RED

class MyColor extends CustomColorization {

    @Override
    Ansi onSuccess() {
        ansi().bold()
    }

    @Override
    Ansi onFailure() {
        ansi().fgBright(RED)
    }
}

Possible custom points are documented in com.github.jcgay.maven.color.core.ConfigurableColor.

Customization is done by returning an Ansi instance with desired behavior.
If you don't wan't to modify a style just return an unconfigured ansi() instance like

@Override
Ansi onSuccess() {
    ansi()
}

You can refer to default maven-color implementation in com.github.jcgay.maven.color.core.DefaultColorConfiguration .

Clone this wiki locally