调色板和更多比例变化

问题描述 投票:0回答:0

我这里有两个代码,所以你可以帮助我理解......
好吧,起初我的面具为“加载”形状着色。首字母

rgbkmcw
表示它们的颜色,红色,...,白色。这些都是正常的,已经是大写字母了,对应粗体
(red = \e[31;10m; RED = \e[31;1m)
.
我正在寻找的是更多种类的颜色。搜索我发现了很多,还有青色。
cyan = "\e[36;10m",  normal

cyann = "\e[36;1m",  bold

cyanf = "\e[36;2m",  weak

cyani = "\e[36;3m",  italic

cyans = "\e[36;4m",  underscore

cyanp = "\e[36;5m",  flashing

cyanb = "\e[36;7m",  background

cyanc = "\e[36;9m",  canceled

如何在缩写为某些字母或数字的掩码中使用其中一种颜色?因为每一个面具中的每个字符都代表对象中相应字符的颜色。
例如:你想用青色斜体; cyan normal 和 bold 已经在 Term::Animation 模块中用 c 和 C 定义了。

所以当尝试执行“ci”并运行 perl 时;返回 ->

Use uninitialized value in stanza entry in /usr/local/share/perl/5.34.0/Term/Animation.pm

为什么没有定义斜体青色(ci)。我去了
cd usr/local/share/perl/5.34.0/Term/Animation.pm

并在那里创建映射完整颜色名称(例如“蓝色”)和单个字符颜色 ID(例如“b”)的列表

#---------- cd usr/local/share/perl/5.34.0/Term/----------
sub _color_list {
        my %color_n;
        my %color_i = (
                black   => 'k',
                white   => 'w',
                red     => 'r',
                green   => 'g',
                blue    => 'b',
                cyan    => 'c',
                magenta => 'm',
                yellow  => 'y',
        );

        for (keys %color_i) {
                $color_i{uc($_)} = uc($color_i{$_});
        }
        for (keys %color_i) {
                $color_n{$color_i{$_}} = $_;
                $color_n{$_} = $_;
                $color_n{uc($_)} = uc($_);
        }    
        for(qw{ k w r g b c m y }) {
                $color_i{$_} = $_;
                $color_i{uc($_)} = uc($_);
        }    
        return (\%color_n, \%color_i);
}  

我需要包括更多的颜色变化,像这样color.
那么,如何在Animation.pm模块中直接添加一个颜色,如cyan italic =

\e[36;3m;
?
我尝试查询 link metacpan 中的 Term::Animation/COLOR 部分,但页面返回“未找到”。

#---------------------MY MASK--------------------------  
use strict;
use warnings;
# you don't have to include Curses, but it is handy so we
# can use halfdelay and getch below.
use Curses;
use Term::Animation 2.0;
# this creates a full screen animation object. you can also
# pass a curses window as an argument to new()
my $s = Term::Animation->new();

$s->color(1);
my $phrase = "Press q to exit";
# a few simple ASCII art objects to move around

my @loading= (q{
================
});
my @mask = (q{
RrBbWwKkYyMmCcGg
});
$s->new_entity(
        shape           => \@loading,
        position        => [ 30, 2, 20],
        callback_args   => [0,0,0,1],
        color   => \@mask,
);
halfdelay( 2 );
for(1..500) {

$s->animate();
my $in = lc( getch() );
if($in eq 'q') { last; }
}

use strict;
use warnings;
use feature 'say';

my $cyan  = "\e[36;10m";#normal
my $cyann = "\e[36;1m"; #bold
my $cyanf = "\e[36;2m"; #weak

my $off = "\e[m";       #off

say("$cyan    cyan   $off");
say("$cyann   cyann  $off");
say("$cyanf   cyanf  $off");
perl curses
© www.soinside.com 2019 - 2024. All rights reserved.