Color console - is this possible in near future?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Color console - is this possible in near future?

Zbigniew Komarnicki
Hi

Would it be possible that in the near future would
be available in the Octave console color?

I tried to do the test in the Octave console color
using ANSI escape codes but the console did not even
wrote out the text. Is this behavior is normal that
even the text was not printed on the console?
Is this a bug in the implementation? Please see
the screen shot: "color_test_octave.jpeg".

For a change, I did a test in Matlab and there
colored console is implemented. Please see
the screen shot: "color_test_matlab.jpeg".

Is the color in the near future console would be
available in Octave to be more close (compatible)
with Matlab?

Try this:
fprintf(1,'\033[31mThis is a test.\033[36m Here another color.
\033[37;41;1m Now is background color and white bold.\033[0m\n');

I'm using:
GNU Octave, version 3.6.2
Copyright (C) 2012 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "x86_64-unknown-linux-gnu".

Regards

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

color_test_matlab.jpeg (20K) Download Attachment
color_test_octave.jpeg (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Color console - is this possible in near future?

c.-2

On 9 Nov 2012, at 10:00, Zbigniew Komarnicki wrote:

>
> Try this:
> fprintf(1,'\033[31mThis is a test.\033[36m Here another color.
> \033[37;41;1m Now is background color and white bold.\033[0m\n');

The following works as you would expect in Octave:

fprintf(1, [char(27), ...
          '[31mThis is a test.', ...
           char(27), ...
          '[36m Here another color.', ...
           char(27), ...
          '[37;41;1m Now is background color and white bold.', ...
           char(27), ...
          '[0m\n']);

And it also works in Matlab if you need compatible code.

c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Color console - is this possible in near future?

Zbigniew Komarnicki
On Friday 09 of November 2012 10:38:07 you wrote:

> The following works as you would expect in Octave:
>
> fprintf(1, [char(27), ...
>           '[31mThis is a test.', ...
>            char(27), ...
>           '[36m Here another color.', ...
>            char(27), ...
>           '[37;41;1m Now is background color and white bold.', ...
>            char(27), ...
>           '[0m\n']);
>
> And it also works in Matlab if you need compatible code.
>
> c.

Thank you for your quick answer.

Regards
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Color console - is this possible in near future?

nrjank
On Fri, Nov 9, 2012 at 4:44 AM, Zbigniew Komarnicki <[hidden email]> wrote:
On Friday 09 of November 2012 10:38:07 you wrote:
> The following works as you would expect in Octave:
>
> fprintf(1, [char(27), ...
>           '[31mThis is a test.', ...
>            char(27), ...
>           '[36m Here another color.', ...
>            char(27), ...
>           '[37;41;1m Now is background color and white bold.', ...
>            char(27), ...
>           '[0m\n']);
>
> And it also works in Matlab if you need compatible code.
>
> c.

Thank you for your quick answer.

Regards
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


interesting.... running the MinGW 3.6.2 octave-forge package I get:

octave:1> fprintf(1, [char(27), ...
>           '[31mThis is a test.', ...
>            char(27), ...
>           '[36m Here another color.', ...
>            char(27), ...
>           '[37;41;1m Now is background color and white bold.', ...
>            char(27), ...
>           '[0m\n']);

←[31mThis is a test.←[36m Here another color.←[37;41;1m Now is background color and white bold.←[0m
<ar(27),'[37;41;1m Now is background color and white bold.',char(27),'[0m\n']);

all in black and white. is that just a function of the console or default config that this version uses? running it from the Windows cmd shell or Windows Powershell does the same.

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Color console - is this possible in near future?

Jordi Gutiérrez Hermoso-2
On 9 November 2012 08:17, Nicholas Jankowski <[hidden email]> wrote:

> interesting.... running the MinGW 3.6.2 octave-forge package I get:
>
> octave:1> fprintf(1, [char(27), ...
>
>>           '[31mThis is a test.', ...
>>            char(27), ...
>>           '[36m Here another color.', ...
>>            char(27), ...
>>           '[37;41;1m Now is background color and white bold.', ...
>>            char(27), ...
>>           '[0m\n']);
>
> ←[31mThis is a test.←[36m Here another color.←[37;41;1m Now is background
> color and white bold.←[0m
> <ar(27),'[37;41;1m Now is background color and white
> bold.',char(27),'[0m\n']);
>
> all in black and white. is that just a function of the console or default
> config that this version uses? running it from the Windows cmd shell or
> Windows Powershell does the same.

This is a problem with ANSI colour codes: they just don't work on
Windows. cmd.exe is a very limited shell, if you ask me, and I guess
Powershell inherits some of its limitation.

This lack of colour codes is one reason why e.g. Mercurial disables
the colour extension by default: it just doesn't work on Windows.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

RE: Color console - is this possible in near future?

Allen.Windhorn-2
In reply to this post by nrjank
Nick,

From: [hidden email] On Behalf Of Nicholas Jankowski

On Fri, Nov 9, 2012 at 4:44 AM, <[hidden email]> wrote:
On Friday 09 of November 2012 10:38:07 you wrote:
>> The following works as you would expect in Octave:
>>
>> fprintf(1, [char(27), ...
>> ...
>>           '[0m\n']);

> interesting.... running the MinGW 3.6.2 octave-forge package I get:
> ...
> ←[31mThis is a test.←[36m Here another color.←[37;41;1m Now is
> background color and white bold.←[0m
> <ar(27),'[37;41;1m Now is background color and white bold.',
> char(27),'[0m\n']);
>
> all in black and white. is that just a function of the console or
> default config that this version uses? running it from the Windows
> cmd shell or Windows Powershell does the same.

In Windows, you have to start the shell with the /c option, which
turns on the ANSI shell extensions.  I don't know how that can be
done from Octave directly.

Regards,
Allen


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Color console - is this possible in near future?

martin_helm
In reply to this post by nrjank
Am 09.11.2012 14:17, schrieb Nicholas Jankowski:

>
> interesting.... running the MinGW 3.6.2 octave-forge package I get:
>
> octave:1> fprintf(1, [char(27), ...
> > '[31mThis is a test.', ...
> > char(27), ...
> > '[36m Here another color.', ...
> > char(27), ...
> > '[37;41;1m Now is background color and white bold.', ...
> > char(27), ...
> > '[0m\n']);
>
> ←[31mThis is a test.←[36m Here another color.←[37;41;1m Now is
> background color and white bold.←[0m
> <ar(27),'[37;41;1m Now is background color and white
> bold.',char(27),'[0m\n']);
>
> all in black and white. is that just a function of the console or
> default config that this version uses? running it from the Windows cmd
> shell or Windows Powershell does the same.
>
I never tried it myself, but have a look at ansicon
https://github.com/adoxa/ansicon/downloads
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave