http://qs321.pair.com?node_id=11146203


in reply to Re^4: 'rgb_palette' - Term::ANSIColor Helper -- errors on strawberry
in thread 'rgb_palette' - Term::ANSIColor Helper

It's down to the version of Term::ANSIColor.

I had Strawberry 5.30.0.1's default Term::ANSIColor v4.06, and it gave me the same error Discipulus saw. I tried

@echo =================== 8 v 16 perl -E "use Term::ANSIColor; say my $x=colored('red text', 'red on_wh +ite'); use Data::Dump; dd $x" perl -E "use Term::ANSIColor; say my $x=colored('red text', 'bright_re +d on_white'); use Data::Dump; dd $x" perl -E "use Term::ANSIColor; use Data::Dump; my $x = colored('black o +n white', 'black on_white'); say $x; dd $x" @echo =================== 256 vs 8 or 16 perl -E "use Term::ANSIColor; use Data::Dump; my $x = colored('black o +n white', 'rgb000 on_white'); say $x; dd $x" @echo =================== [id://11146167] perl -E "use Term::ANSIColor; use Data::Dump; my $x = colored('black o +n white', 'r0g0b0 on_white'); say $x; dd $x" perl -E "say qq(\e[38;5;16;47mblack on white\e[0m)" perl -E "say qq(\e[38;2;0;0;0;47mblack on white\e[0m)" perl -E "say qq(\e[38;2;255;0;0;47mred on white\e[0m)" perl -E "say qq(\e[38;2;0;127;0;47mgreen on white\e[0m)" perl -E "say qq(\e[38;2;0;0;255;47mblue on white\e[0m)" perl -E "say qq(\e[38;2;191;127;191;47mpurple on white\e[0m)" perl -E "use Term::ANSIColor; use Config; say for $Term::ANSIColor::VE +RSION, $], $Config{myuname};"
... And everything but the r0g0b0 worked†; the r0g0b0 gave Invalid attribute name r0g0b0 at -e line 1.

I then realized that since kcott was using v5.36, there was probably a newer Term::ANSIColor , so then I ran cpanm Term::ANSIColor, which installed 5.01. When I ran my same batch script with the updated module, it worked without the error.

So Discipulus, you need to update Term::ANSIColor. Per their change list, rNNNgNNNbNNN notation was added in 5.00.

(To get the colors to work, I did use the VirtualTerminalLevel = 1 that the AM recommended)


edit: †: with full 24 bit color working fine for the red, green, blue, and purple, using manual escape sequences.