Используйте Convert :: Color для получения такого вида вывода:
mauve is 0xE0B0FF sRGB=[224,176,255] HSV=[276, 31,100]
vermilion is 0xE34234 sRGB=[227, 66, 52] HSV=[ 5, 77, 89]
mix is 0xE2799A sRGB=[226,121,154] HSV=[341, 46, 89]
red is 0xFF0000 sRGB=[255, 0, 0] HSV=[ 0,100,100]
blue is 0x0000FF sRGB=[ 0, 0,255] HSV=[240,100,100]
red+blue is 0x800080 sRGB=[128, 0,128] HSV=[300,100, 50]
black is 0xFFFFFF sRGB=[255,255,255] HSV=[ 0, 0,100]
white is 0x000000 sRGB=[ 0, 0, 0] HSV=[ 0, 0, 0]
grey is 0x808080 sRGB=[128,128,128] HSV=[ 0, 0, 50]
dark red is 0xFF8080 sRGB=[255,128,128] HSV=[ 0, 50,100]
light red is 0x800000 sRGB=[128, 0, 0] HSV=[ 0,100, 50]
pink is 0x800080 sRGB=[128, 0,128] HSV=[300,100, 50]
deep purple is 0xBF80FF sRGB=[191,128,255] HSV=[270, 50,100]
При запуске кода такого типа:
#!/usr/bin/env perl
use strict;
use warnings;
use Convert::Color;
main();
exit;
sub rgb($$$) {
my($r, $g, $b) = @_;
return new Convert::Color:: "rgb8:$r,$g,$b";
}
sub show($$) {
my ($name, $color) = @_;
printf "%-12s is 0x%6s", $name, uc $color->hex;
printf " sRGB=[%3d,%3d,%3d] ", $color->rgb8;
my ($h,$s,$v) = $color->as_hsv->hsv;
for ($s, $v) { $_ *= 100 }
printf " HSV=[%3.0f,%3.0f,%3.0f] ", $h, $s, $v;
print "\n";
}
sub main {
my $vermilion = rgb 227, 66, 52;
my $mauve = rgb 224, 176, 255;
show mauve => $mauve;
show vermilion => $vermilion;
my $mix = alpha_blend $mauve $vermilion;
show mix => $mix;
print "\n";
my $red = rgb 255, 0, 0;
my $blue = rgb 0, 0, 255;
show red => $red;
show blue => $blue;
$mix = alpha_blend $red $blue;
show "red+blue" => $mix;
print "\n";
my $black = rgb 255, 255, 255;
my $white = rgb 0, 0, 0;
show black => $black;
show white => $white;
my $grey = alpha_blend $black $white;
show grey => $grey;
print "\n";
my $dark_red = alpha_blend $red $black;
my $light_red = alpha_blend $red $white;
show "dark red" => $dark_red;
show "light red" => $light_red;
print "\n";
my $magenta = rgb 255, 0, 255;
my $violet = rgb 127, 0, 255;
my $pink = alpha_blend $magenta $white;
my $deep_purple = alpha_blend $violet $black;
show pink => $pink;
show "deep purple" => $deep_purple;;
}