Color::Library(3pm)
β¨ Color::Library β¨
okay bestie, sit down, we're talking about Color::Library β yes, the Perl one, manual section 3pm, and it's giving named colors, but make it comprehensive. π
π NAME π
Color::Library β an easy-to-use and comprehensive named-color library. fr fr, that's the whole job.
π VERSION π
version 0.021 β that's the one we're on, no cap.
π SYNOPSIS π
here's the vibe, literally just copy-paste energy:
use Color::Library;
# Search for a sea blue color
my $seablue = Color::Library->color("seablue");
# Search for a grey73 in the 'svg' and 'x11' dictionaries only
my $grey73 = Color::Library->colour([qw/svg x11/] => "grey73");
# Find a bunch of colors at the same time
my ($red, $green, $blue) = Color::Library->colors(qw/red green blue/);
# Fetch the named color "aliceblue" from the SVG dictionary
my $color = Color::Library->SVG->color("aliceblue");
# Prints out "aliceblue is #ff08ff"
print $color->name, "is ", $color, "\n";
# Get a list of names in the svg dictionary
my @names = Color::Library->SVG->names;
# Get a list of colors in the x11 dictionary
my @colors = Color::Library->dictionary('x11')->colors;
π¦ DESCRIPTION π¦
Color::Library is an easy-to-use and comprehensive named-color dictionary. Right now it's got coverage for www colors (svg, html, css), x11 colors, and more. and more!! π it's so much.
π DICTIONARIES π
the following dictionaries ship in this distribution, and there are a lot of them. we do not gatekeep:
Color::Library::Dictionary::SVG - Colors from the SVG specification
Color::Library::Dictionary::X11 - Colors for the X11 Window System (rgb.txt)
Color::Library::Dictionary::HTML - Colors from the HTML 4.0 specification
Color::Library::Dictionary::IE - Colors recognized by Internet Explorer
Color::Library::Dictionary::Mozilla - Colors recognized by Mozilla (ColorNames.txt)
Color::Library::Dictionary::Netscape - Colors recognized by Netscape
Color::Library::Dictionary::Windows - Colors from the Windows system palette
Color::Library::Dictionary::VACCC - VisiBone Anglo-Centric Color Code
Color::Library::Dictionary::NBS_ISCC - Centroids of the NBS/ISCC catalog
Color::Library::Dictionary::NBS_ISCC::A - Dye Colors
Color::Library::Dictionary::NBS_ISCC::B - Colour Terminology in Biology
Color::Library::Dictionary::NBS_ISCC::F - Colors; (for) Ready-Mixed Paints
Color::Library::Dictionary::NBS_ISCC::H - Horticultural Colour Charts
Color::Library::Dictionary::NBS_ISCC::M - Dictionary of Color
Color::Library::Dictionary::NBS_ISCC::P - Plochere Color System
Color::Library::Dictionary::NBS_ISCC::R - Color Standards and Color Nomenclature
Color::Library::Dictionary::NBS_ISCC::RC - Rock-Color Chart
Color::Library::Dictionary::NBS_ISCC::S - Postage-Stamp Color Names
Color::Library::Dictionary::NBS_ISCC::SC - Soil Color Charts
Color::Library::Dictionary::NBS_ISCC::TC - Standard Color Card of America
want to see the colors inside any one of these? just read their perldoc, it's that simple. like:
perldoc Color::Library::Dictionary::VACCC
got suggestions for more color dictionaries to integrate? contact me. I'm literally always down. π«Ά
π METHODS π
$dictionary = Color::Library->dictionary( <dictionary_id> )β hands you back aColor::Library::Dictionaryobject that matches<dictionary_id>. that's it, that's the method.@dictionaries = Color::Library->dictionaries@dictionaries = Color::Library->dictionaries( <dictionary_id>, <dictionary_id>, ... )$dictionaries = Color::Library->dictionaries( <dictionary_id>, <dictionary_id>, ... )β okay so this one's context-sensitive, pay attention bestie:- in list context, you get a list of
Color::Library::Dictionaryobjects β one for each<dictionary_id>you passed in. - in scalar context, you get a hash of
Color::Library::Dictionaryobjects, mapping a dictionary id to a dictionary. - and if you call it with no arguments at all, it returns all the dictionaries. all of them. every last one. π
- in list context, you get a list of
$color = Color::Library->color( <query> )β returns aColor::Library::Colorobject found via<query>. and a<query>can be any of these, bestie:- color name β a color name is like
"blue"or"bleached-almond". - color title β a color title is like
"Dark Green-Teal". - color id β a color id is in the form of
<dictionary_id>:<color_name>, for example:"x11:azure1".
- color name β a color name is like
color( <query>, <query>, ... )β multiple queries at once, obsessed:- in list context, returns a list of
Color::Library::Colorobjects corresponding to each<query>. - in scalar context, just returns the first
<query>. first come first served, periodt.
- in list context, returns a list of
color( <dictionaries>, <query>, ... )β if you pass an array reference as the first argument, that means the array is a list of dictionary ids to search through, in order:
# Search in the svg and x11 dictionaries for a match
my $blue = Color::Library->color([qw/svg x11/], "blue");
# Will not find "aquamarine1" in the svg dictionary, so it will try the x11 dictionary
my $aquamarine1 = Color::Library->color([qw/svg x11/], "aquamarine1");
$color = Color::Library->colors$color = Color::Library->colour$color = Color::Library->coloursβ all three of these are aliases for thecolormethod above. spelling is fake, the colors are real. πΈ
π ABOUT π
this package was inspired by Graphics::ColorNames, and it covers much of the same ground. however β and this is the tea β I found the Graphics::ColorNames interface difficult to use. I also wanted to list colors directly in the perldoc, which this package does. main character behavior, honestly. π
β SEE ALSO β
Graphics::ColorNames
π§ AUTHOR π§
Robert Krimen <robertkrimen@gmail.com> π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2011 by Robert Krimen.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay.
and that's the whole page, bestie!! this was generated for perl v5.36.0 on 2022-11-27 β go forth and name some colors. πβ¨π¦
π¦ 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