mihnita / ansi-econsole

Eclipse plugin that understands ANSI escape sequences to color the Eclipse console output.
http://www.mihai-nita.net/java/
Other
90 stars 25 forks source link

Not working for me #26

Closed Mrodent closed 7 years ago

Mrodent commented 7 years ago

Hi, just discovered this. Installed in Eclipse Neon... reboot... in the Windows --> Prefs menu there is now an entry "Ansi Console"... which is "Enabled".

But this test program just printed out in black & white:

import org.fusesource.jansi.AnsiConsole;
import static org.fusesource.jansi.Ansi.*;
import static org.fusesource.jansi.Ansi.Color.*;

public class JansiExp {

    public static void main(String[] args) {
        AnsiConsole.systemInstall();
        // System.out.println( ansi().eraseScreen().fg(RED).a("Hello").fg(GREEN).a(" World").reset() );
        System.out.println( ansi().eraseScreen().render("@|red Hello|@ @|green World|@") );
    }
}

What am I doing wrong?

PS I also ran this in a console outside Eclipse (Cygwin)... the colours then worked fine.

mihnita commented 7 years ago

If you use jansi, it might look like the plugin does not work.That is because jansi detects when the standard output is redirected and does not output the escape sequences anymore. So try adding this to your code, before using jansi: System.setProperty("jansi.passthrough", "true"); To make sure is it not a problem with the plugin, try not using jansi.For instance  System.out.println("This is \u001b[91mRED\u001b[m");

Mihai

On Monday, 27 February 2017, 11:08, Mrodent <notifications@github.com> wrote:

Hi, just discovered this. Installed in Eclipse Neon... reboot... in the Windows --> Prefs menu there is now an entry "Ansi Console"... which is "Enabled".But this test program just printed out in black & white:

import org.fusesource.jansi.AnsiConsole; import static org.fusesource.jansi.Ansi.; import static org.fusesource.jansi.Ansi.Color.;

public class JansiExp {

public static void main(String[] args) {
    AnsiConsole.systemInstall();
    // System.out.println( ansi().eraseScreen().fg(RED).a("Hello").fg(GREEN).a(" World").reset() );
    System.out.println( ansi().eraseScreen().render("@|red Hello|@ @|green World|@") );
}

}

What am I doing wrong?PS I also ran this in a console outside Eclipse (Cygwin)... the colours then worked fine.— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.