You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Peter Cheung <mc...@hotmail.com> on 2018/05/24 16:54:33 UTC

output window coloring question

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

Re: output window coloring question

Posted by Peter Cheung <mc...@hotmail.com>.
Yes you are right, if i switch back to old maven, it back to works. thanks


Thanks
From Peter


________________________________
From: cowwoc <co...@bbs.darktech.org>
Sent: Saturday, May 26, 2018 2:36 AM
To: dev@netbeans.incubator.apache.org
Subject: Re: output window coloring question

On a related note, Maven 5.0+ is using ANSI colors in a very nice way
but this won't work in Netbeans.

I suggest a committer contact the author of JANSI through
https://github.com/fusesource/jansi/issues/87 to debug this further.
[https://avatars2.githubusercontent.com/u/633348?s=400&v=4]<https://github.com/fusesource/jansi/issues/87>

Netbeans support �� Issue #87 �� fusesource/jansi �� GitHub<https://github.com/fusesource/jansi/issues/87>
github.com
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.




Kind regards,
Gili

On 2018-05-25 6:49 AM, Peter Cheung wrote:
> i am using system.out
>
>
> Thanks
>  From Peter
> ________________________________
> From: Emilian Bold <em...@protonmail.ch>
> Sent: Friday, May 25, 2018 1:02:26 AM
> To: dev@netbeans.incubator.apache.org
> Subject: Re: output window coloring question
>
> Maven is being executed as an external process which writes to a terminal. NetBeans has a basic VT100 terminal that probably takes care of some colors.
>
> My guess is you are writing to the InputOutput stream which has no official ANSI support except via IOColorLines.println which accepts a Color argument.
>
> --emi
>
> �\�\�\�\�\�\�\ Original Message �\�\�\�\�\�\�\
>
> On 24 May 2018 7:54 PM, Peter Cheung <mc...@hotmail.com> wrote:
>
>> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: output window coloring question

Posted by cowwoc <co...@bbs.darktech.org>.
On a related note, Maven 5.0+ is using ANSI colors in a very nice way 
but this won't work in Netbeans.

I suggest a committer contact the author of JANSI through 
https://github.com/fusesource/jansi/issues/87 to debug this further.

Kind regards,
Gili

On 2018-05-25 6:49 AM, Peter Cheung wrote:
> i am using system.out
>
>
> Thanks
>  From Peter
> ________________________________
> From: Emilian Bold <em...@protonmail.ch>
> Sent: Friday, May 25, 2018 1:02:26 AM
> To: dev@netbeans.incubator.apache.org
> Subject: Re: output window coloring question
>
> Maven is being executed as an external process which writes to a terminal. NetBeans has a basic VT100 terminal that probably takes care of some colors.
>
> My guess is you are writing to the InputOutput stream which has no official ANSI support except via IOColorLines.println which accepts a Color argument.
>
> --emi
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On 24 May 2018 7:54 PM, Peter Cheung <mc...@hotmail.com> wrote:
>
>> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: output window coloring question

Posted by Peter Cheung <mc...@hotmail.com>.
i am using system.out


Thanks
From Peter
________________________________
From: Emilian Bold <em...@protonmail.ch>
Sent: Friday, May 25, 2018 1:02:26 AM
To: dev@netbeans.incubator.apache.org
Subject: Re: output window coloring question

Maven is being executed as an external process which writes to a terminal. NetBeans has a basic VT100 terminal that probably takes care of some colors.

My guess is you are writing to the InputOutput stream which has no official ANSI support except via IOColorLines.println which accepts a Color argument.

--emi

�\�\�\�\�\�\�\ Original Message �\�\�\�\�\�\�\

On 24 May 2018 7:54 PM, Peter Cheung <mc...@hotmail.com> wrote:

> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: output window coloring question

Posted by Emilian Bold <em...@protonmail.ch>.
Maven is being executed as an external process which writes to a terminal. NetBeans has a basic VT100 terminal that probably takes care of some colors.

My guess is you are writing to the InputOutput stream which has no official ANSI support except via IOColorLines.println which accepts a Color argument.

--emi

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On 24 May 2018 7:54 PM, Peter Cheung <mc...@hotmail.com> wrote:

> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists