Color:...::Color(3pm)
β¨ NAME β¨
Color::Library::Color β it's literally a single color entry for a Color::Library color dictionary π the lil main character of one (1) swatch, no cap
π METHODS π
$id = $color->idβ hands you back the id of the color π«Ά
An id is formatted like <dictionary_id:color_name>, bestie. For example:
svg:aliceblue
x11:bisque2
nbs-iscc-f:chromeyellow.66
vaccc:darkspringyellow
$name = $color->nameβ gives you the name of the color, like:
aliceblue
bisque2
chromeyellow
darkspringyellow
$title = $color->titleβ gives you the title</title> of the color, like:
aliceblue
bisque2
chrome yellow
Dark Spring-Yellow
$dictionary = $color->dictionaryβ returns theColor::Library::Dictionaryobject that this color belongs to π¦ (yes, every color knows its home dictionary, iconic)$hex = $color->hexβ returns the hex value of the color, like:
ff08ff
eed5b7
eaa221
669900
Heads up bestie:$hexdoes NOT include the leading#. If you want that lil hash, use$color->html,$color->css, or$color->svgπ
$html = $color->html$css = $color->css$svg = $color->svgβ these three return the hex value of the color with a leading#, so it's ready to drop straight into HTML, CSS, or SVG documents. Example time:
#ff08ff
#eed5b7
#eaa221
#669900
$value = $color->valueβ returns the numeric value of the color, like:
15792383
15652279
15376929
6723840
($r, $g, $b) = $color->rgbβ in list context, returns the r, g, and b values of the color as a 3 element list π like:
(240, 248, 255)
$rgb = $color->rgbβ in scalar context, returns r, g, and b as a 3 element array, like:
[ 240, 248, 255 ]
$color = Color::Library::Color->new( id => $id, name => $name, title => $title, value => $value )$color = Color::Library::Color->new( { id => $id, name => $name, title => $title, value => $value } )$color = Color::Library::Color->new( [[ $id, $name, $title, $rgb, $hex, $value ]] )β returns a fresh newColor::Library::Colorobject representing the color you specified β¨
Ngl, you probably don't want or need to call this yourself π
π§ FUNCTIONS π§
$hex = Color::Library::Color::rgb2hex( $rgb )$hex = Color::Library::Color::rgb2hex( $r, $g, $b )β converts an rgb value into its hex representation π$value = Color::Library::Color::rgb2value( $rgb )$value = Color::Library::Color::rgb2value( $r, $g, $b )β converts an rgb value into its numeric representation$rgb = Color::Library::Color::value2rgb( $value )($r, $g, $b) = Color::Library::Color::value2rgb( $value )β converts a numeric color value into its rgb representation π($r, $g, $b) = Color::Library::Color::parse_rgb_color( $hex )($r, $g, $b) = Color::Library::Color::parse_rgb_color( $value )β makes a best effort to convert a hex or numeric color value into its rgb representation π
okay that's the whole page, you ate it, periodt π
Cute lil sign-off: this one's from perl v5.36.0, dated 2022-11-27 π bye bestie, go paint something pretty πΈ
π¦ where this page comes from
- debian bookworm: libcolor-library-perl 0.021-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcolor-library-perl 0.021-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcolor-library-perl 0.021-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms