Color::Library::Color
Color entry for a Color::Library color dictionary
- Provided by: libcolor-library-perl (Version: 0.021-2)
- Report a bug
Color entry for a Color::Library color dictionary
A color id is in the format of <dictionary_id:color_name>, e.g.
svg:aliceblue
x11:bisque2
nbs-iscc-f:chromeyellow.66
vaccc:darkspringyellow
aliceblue
bisque2
chromeyellow
darkspringyellow
aliceblue
bisque2
chrome yellow
Dark Spring-Yellow
ff08ff
eed5b7
eaa221
669900
Note that $hex does NOT include the leading #, for that use $color->html, $color->css, or $color->svg
#ff08ff
#eed5b7
#eaa221
#669900
15792383
15652279
15376929
6723840
(240, 248, 255)
[ 240, 248, 255 ]
You probably don't want/need to call this yourself
# Partly taken from Imager/Color.pm sub parse_rgb_color {
return (@_) if @_ == 3 && ! grep
/[^\d.+eE-]/, @_;
if ($_[0] =~ /^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])$/i) {
return (hex($1), hex($2), hex($3));
}
if ($_[0] =~ /^\#?([\da-f])([\da-f])([\da-f])$/i) {
return (hex($1) * 17, hex($2) * 17, hex($3) * 17);
}
return value2rgb $_[0] if 1 ==
@_ && $_[0] =~
m/^\d+$/; }
1;
__END__
sub parse_rgbs_color {
return (@_) if @_ == 3 && ! grep
/[^\d.+eE-]/, @_;
if ($_[0] =~
/^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
return (hex($1), hex($2), hex($3), hex($4));
}
if ($_[0] =~ /^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
return (hex($1), hex($2), hex($3), 255);
}
if ($_[0] =~ /^\#([\da-f])([\da-f])([\da-f])$/i) {
return (hex($1) * 17, hex($2) * 17, hex($3) * 17, 255);
}
return value2rgb $_[0] if 1 ==
@_; }