Hi
i saw maven can print colored text in output window, after hacking maven, i
know it uses library "org.fusesource.jansi.Ansi" to print colored text, but my
testing program still can't see any color. The most amazing thing is that : in
the output window, maven's text has color, but just my text has no color. Any
hints?
my testing program:
import org.junit.Test;
import static org.fusesource.jansi.Ansi.*;
import static org.fusesource.jansi.Ansi.Color.*;
import org.fusesource.jansi.AnsiConsole;
public class TestConsole {
@Test
public void test() throws Exception {
// String ANSI_RESET = "\u001B[0m";
// String ANSI_RED = "\u001B[31m";
// System.out.print(ANSI_RED + "XX");
// System.out.flush();
// System.out.println(ANSI_RESET);
// System.out.println("\033[31;1mHello\033[0m, \033[32;1;2mworld!\033[0m");
// System.out.println((char) 27 + "[31m" + "ERROR MESSAGE IN RED");
// System.out.println((char) 27 + "[33mYELLOW");
AnsiConsole.systemInstall();
System.out.println(ansi().eraseScreen().fg(RED).a("Hello").fg(GREEN).a("
World").reset());
}
}
Thanks
>From Peter