.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Color::Library::Color 3pm" .TH Color::Library::Color 3pm "2013-06-11" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Color::Library::Color \- Color entry for a Color::Library color dictionary .SH "METHODS" .IX Header "METHODS" .ie n .IP "$id = $color\->id" 4 .el .IP "\f(CW$id\fR = \f(CW$color\fR\->id" 4 .IX Item "$id = $color->id" Returns the id of the color .Sp A color id is in the format of , e.g. .Sp .Vb 4 \& svg:aliceblue \& x11:bisque2 \& nbs\-iscc\-f:chromeyellow.66 \& vaccc:darkspringyellow .Ve .ie n .IP "$name = $color\->name" 4 .el .IP "\f(CW$name\fR = \f(CW$color\fR\->name" 4 .IX Item "$name = $color->name" Returns the name of the color, e.g. .Sp .Vb 4 \& aliceblue \& bisque2 \& chromeyellow \& darkspringyellow .Ve .ie n .IP "$title = $color\->title" 4 .el .IP "\f(CW$title\fR = \f(CW$color\fR\->title" 4 .IX Item "$title = $color->title" Returns the title of the color, e.g. .Sp .Vb 4 \& aliceblue \& bisque2 \& chrome yellow \& Dark Spring\-Yellow .Ve .ie n .IP "$dictionary = $color\->dictionary" 4 .el .IP "\f(CW$dictionary\fR = \f(CW$color\fR\->dictionary" 4 .IX Item "$dictionary = $color->dictionary" Returns the Color::Library::Dictionary object that the color belongs to .ie n .IP "$hex = $color\->hex" 4 .el .IP "\f(CW$hex\fR = \f(CW$color\fR\->hex" 4 .IX Item "$hex = $color->hex" Returns the hex value of the color, e.g. .Sp .Vb 4 \& ff08ff \& eed5b7 \& eaa221 \& 669900 .Ve .Sp Note that \f(CW$hex\fR does \s-1NOT\s0 include the leading #, for that use \f(CW$color\fR\->html, \f(CW$color\fR\->css, or \f(CW$color\fR\->svg .ie n .IP "$html = $color\->html" 4 .el .IP "\f(CW$html\fR = \f(CW$color\fR\->html" 4 .IX Item "$html = $color->html" .PD 0 .ie n .IP "$css = $color\->css" 4 .el .IP "\f(CW$css\fR = \f(CW$color\fR\->css" 4 .IX Item "$css = $color->css" .ie n .IP "$svg = $color\->svg" 4 .el .IP "\f(CW$svg\fR = \f(CW$color\fR\->svg" 4 .IX Item "$svg = $color->svg" .PD Returns the hex value of the color with a leading #, suitable for use in \s-1HTML\s0, \s-1CSS\s0, or \s-1SVG\s0 documents, e.g. .Sp .Vb 4 \& #ff08ff \& #eed5b7 \& #eaa221 \& #669900 .Ve .ie n .IP "$value = $color\->value" 4 .el .IP "\f(CW$value\fR = \f(CW$color\fR\->value" 4 .IX Item "$value = $color->value" Returns the numeric value of the color, e.g. .Sp .Vb 4 \& 15792383 \& 15652279 \& 15376929 \& 6723840 .Ve .ie n .IP "($r, $g, $b) = $color\->rgb" 4 .el .IP "($r, \f(CW$g\fR, \f(CW$b\fR) = \f(CW$color\fR\->rgb" 4 .IX Item "($r, $g, $b) = $color->rgb" Returns r, g, and b values of the color as a 3 element list (list context), e.g. .Sp .Vb 1 \& (240, 248, 255) .Ve .ie n .IP "$rgb = $color\->rgb" 4 .el .IP "\f(CW$rgb\fR = \f(CW$color\fR\->rgb" 4 .IX Item "$rgb = $color->rgb" Returns r, g, and b values of the color in a 3 element array (scalar context), e.g. .Sp .Vb 1 \& [ 240, 248, 255 ] .Ve .ie n .IP "$color = Color::Library::Color\->new( id => $id, name => $name, title => $title, value => $value )" 4 .el .IP "\f(CW$color\fR = Color::Library::Color\->new( id => \f(CW$id\fR, name => \f(CW$name\fR, title => \f(CW$title\fR, value => \f(CW$value\fR )" 4 .IX Item "$color = Color::Library::Color->new( id => $id, name => $name, title => $title, value => $value )" .PD 0 .ie n .IP "$color = Color::Library::Color\->new( { id => $id, name => $name, title => $title, value => $value } )" 4 .el .IP "\f(CW$color\fR = Color::Library::Color\->new( { id => \f(CW$id\fR, name => \f(CW$name\fR, title => \f(CW$title\fR, value => \f(CW$value\fR } )" 4 .IX Item "$color = Color::Library::Color->new( { id => $id, name => $name, title => $title, value => $value } )" .ie n .IP "$color = Color::Library::Color\->new( [[ $id, $name, $title, $rgb, $hex, $value ]] )" 4 .el .IP "\f(CW$color\fR = Color::Library::Color\->new( [[ \f(CW$id\fR, \f(CW$name\fR, \f(CW$title\fR, \f(CW$rgb\fR, \f(CW$hex\fR, \f(CW$value\fR ]] )" 4 .IX Item "$color = Color::Library::Color->new( [[ $id, $name, $title, $rgb, $hex, $value ]] )" .PD Returns a new Color::Library::Color object representing the specified color .Sp You probably don't want/need to call this yourself .SS "\s-1FUNCTIONS\s0" .IX Subsection "FUNCTIONS" .ie n .IP "$hex = Color::Library::Color::rgb2hex( $rgb )" 4 .el .IP "\f(CW$hex\fR = Color::Library::Color::rgb2hex( \f(CW$rgb\fR )" 4 .IX Item "$hex = Color::Library::Color::rgb2hex( $rgb )" .PD 0 .ie n .IP "$hex = Color::Library::Color::rgb2hex( $r, $g, $b )" 4 .el .IP "\f(CW$hex\fR = Color::Library::Color::rgb2hex( \f(CW$r\fR, \f(CW$g\fR, \f(CW$b\fR )" 4 .IX Item "$hex = Color::Library::Color::rgb2hex( $r, $g, $b )" .PD Converts an rgb value to its hex representation .ie n .IP "$value = Color::Library::Color::rgb2value( $rgb )" 4 .el .IP "\f(CW$value\fR = Color::Library::Color::rgb2value( \f(CW$rgb\fR )" 4 .IX Item "$value = Color::Library::Color::rgb2value( $rgb )" .PD 0 .ie n .IP "$value = Color::Library::Color::rgb2value( $r, $g, $b )" 4 .el .IP "\f(CW$value\fR = Color::Library::Color::rgb2value( \f(CW$r\fR, \f(CW$g\fR, \f(CW$b\fR )" 4 .IX Item "$value = Color::Library::Color::rgb2value( $r, $g, $b )" .PD Converts an rgb value to its numeric representation .ie n .IP "$rgb = Color::Library::Color::value2rgb( $value )" 4 .el .IP "\f(CW$rgb\fR = Color::Library::Color::value2rgb( \f(CW$value\fR )" 4 .IX Item "$rgb = Color::Library::Color::value2rgb( $value )" .PD 0 .ie n .IP "($r, $g, $b) = Color::Library::Color::value2rgb( $value )" 4 .el .IP "($r, \f(CW$g\fR, \f(CW$b\fR) = Color::Library::Color::value2rgb( \f(CW$value\fR )" 4 .IX Item "($r, $g, $b) = Color::Library::Color::value2rgb( $value )" .PD Converts a numeric color value to its rgb representation .ie n .IP "($r, $g, $b) = Color::Library::Color::parse_rgb_color( $hex )" 4 .el .IP "($r, \f(CW$g\fR, \f(CW$b\fR) = Color::Library::Color::parse_rgb_color( \f(CW$hex\fR )" 4 .IX Item "($r, $g, $b) = Color::Library::Color::parse_rgb_color( $hex )" .PD 0 .ie n .IP "($r, $g, $b) = Color::Library::Color::parse_rgb_color( $value )" 4 .el .IP "($r, \f(CW$g\fR, \f(CW$b\fR) = Color::Library::Color::parse_rgb_color( \f(CW$value\fR )" 4 .IX Item "($r, $g, $b) = Color::Library::Color::parse_rgb_color( $value )" .PD Makes a best effort to convert a hex or numeric color value to its rgb representation .PP # Partly taken from Imager/Color.pm sub parse_rgb_color { return (@_) if \f(CW@_\fR == 3 && ! grep /[^\ed.+eE\-]/, \f(CW@_\fR; if ($_[0] =~ /^\e#?([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])$/i) { return (hex($1), hex($2), hex($3)); } if ($_[0] =~ /^\e#?([\eda\-f])([\eda\-f])([\eda\-f])$/i) { return (hex($1) * 17, hex($2) * 17, hex($3) * 17); } return value2rgb \f(CW$_\fR[0] if 1 == \f(CW@_\fR && \f(CW$_\fR[0] =~ m/^\ed+$/; } .PP 1; .PP _\|_END_\|_ .PP sub parse_rgbs_color { return (@_) if \f(CW@_\fR == 3 && ! grep /[^\ed.+eE\-]/, \f(CW@_\fR; if ($_[0] =~ /^\e#?([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])/i) { return (hex($1), hex($2), hex($3), hex($4)); } if ($_[0] =~ /^\e#?([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])([\eda\-f][\eda\-f])/i) { return (hex($1), hex($2), hex($3), 255); } if ($_[0] =~ /^\e#([\eda\-f])([\eda\-f])([\eda\-f])$/i) { return (hex($1) * 17, hex($2) * 17, hex($3) * 17, 255); } return value2rgb \f(CW$_\fR[0] if 1 == \f(CW@_\fR; }