Re: print in purple question

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 11/3/24 22:04, Bruce Gray wrote:
> 
> 
>> On Nov 3, 2024, at 22:12, ToddAndMargo via perl6-users <[email protected]> wrote:
>>
>> Hi All,
>>
>> Fedora 41
>> rakudo-pkg-2024.7.0-01.x86_64
>> bash-5.2.32-1.fc41.x86_64
>>
>> I am looking at
>>    https://metacpan.org/pod/Term::ANSIColor
>>
>> trying to figure out how to print in dark purple.
>> I have see dnf5 do this, so I know it is possible.
>>
>> Now one of the hurdles is that purple is not an
>> actual color.  It does not appear on a white
>> light spectrum break out.  Purple is a manifestation
>> of our brains interpreting a mixture of red and blue.
>>
>> So how do I mix red and blue to get dark purple?
>>
>> Many thanks,
>> -T
>>
> 
> Magenta is one of the standard ANSI terminal colors, so that is probably the color you are seeing in the `dnf` output as "purple".
> 
> Simplest example, using module:
> raku -e 'use Terminal::ANSIColor; say color("magenta"), "this is in purple(magenta)", color("reset");'
> 
> Just the four purples, in raw ANSI codes:
> raku -e 'say "\e\[{.[0]};{.[1]}m {.[0]};{.[1]} \e\[m " for (0,1) X (35,95);'
> 
> Full color grid:
> raku -e '
> my @fg = (31..37) X+ (0,60);
> my @bg = (41..47) X+ (0,60);
> say "    ", @bg.fmt("--%3d--", " ");
> for @fg -> $f {
>    print $f.fmt("%3d:");
>    for @bg -> $b {
>      for 0,1 -> $a {
>        my $z = "$a;$f;$b";
>        print "\e\[{$z}m $a \e\[m ";
>      }
>    }
>    say "";
> }'
> 
> For more info:
>      https://azrael.digipen.edu/~mmead/www/mg/ansicolors/index.html
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.