[Israel.pm] text coloring

Michael Spector michael at zend.com
Sun Nov 19 03:13:28 PST 2006

On Sunday 19 November 2006 12:50, Yossi Itzkovich wrote:
> Hi
> Is there a way to give colored text in a standard way ?  We are doing it
> here with:
> $red="\033[31m";
> $black="\033[30m";
> $yellow="\033[35m";

There's a CPAN module you can use: Term::ANSIColor.

> and it looks OK in xterm/dtterm, but vi and excel show no color but the
> gibberish text.
> Is there a way to do it ?

These codes are only supported by terminals...

This is the compatibility table:

                 clear    bold     dark    under    blink   reverse  conceal
 xterm         yes      yes      no      yes     bold      yes      yes
 linux         yes      yes      yes    bold      yes      yes      no
 rxvt          yes      yes      no      yes  bold/black   yes      no
 dtterm        yes      yes      yes     yes    reverse    yes      yes
 teraterm      yes    reverse    no      yes    rev/red    yes      no
 aixterm      kinda   normal     no      yes      no       yes      yes
 PuTTY         yes     color     no      yes      no       yes      no
 Windows       yes      no       no      no       no       yes      no
 Cygwin SSH    yes      yes      no     color    color    color     yes
 Mac Terminal  yes      yes      no      yes      yes      yes      yes

Michael Spector, Software Developer
Zend Technologies +972-3-6139665 ext.223

More information about the Perl mailing list