Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: 'rgb_palette' - Term::ANSIColor Helper -- errors on strawberry

by pryrt (Abbot)
on Aug 17, 2022 at 20:38 UTC ( [id://11146203]=note: print w/replies, xml ) Need Help??


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.

Replies are listed 'Best First'.
Re^6: 'rgb_palette' - Term::ANSIColor Helper -- errors on strawberry
by Discipulus (Canon) on Aug 18, 2022 at 07:44 UTC
    Hello pryrt and kcott,

    yes the upgrade did the trick:

    cpan> upgrade Term::ANSIColor Package namespace installed latest in CPAN file Term::ANSIColor 4.06 5.01 RRA/Term-ANSIColor-5.01 +.tar.gz

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^6: 'rgb_palette' - Term::ANSIColor Helper -- errors on strawberry
by kcott (Archbishop) on Aug 17, 2022 at 23:34 UTC

    G'day pryrt,

    Thanks for your research and discovery.

    Yes, I am using Perl v5.36 and Term::ANSIColor v5.01 came with that (it's a dual-life module).

    The first stable version of Perl with Term::ANSIColor v5.00 (or later) is Perl v5.32.0 (with Term::ANSIColor v5.01): https://perldoc.perl.org/5.32.0/Term::ANSIColor. The most recent version of Perl offered by "Strawberry Perl" is v5.32.1.1. So, presumably, updating Strawberry Perl would be another way to get the required version of Term::ANSIColor.

    [I sent a /msg to Discipulus with a link to your post.]

    — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146203]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found