Color::Library(3pm)

πŸ“¦
version 0.021 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble

✨ 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 a Color::Library::Dictionary object 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::Dictionary objects β€” one for each <dictionary_id> you passed in.
    • in scalar context, you get a hash of Color::Library::Dictionary objects, 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. πŸ‘‘
  • $color = Color::Library->color( <query> ) β€” returns a Color::Library::Color object 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( <query>, <query>, ... ) β€” multiple queries at once, obsessed:
    • in list context, returns a list of Color::Library::Color objects corresponding to each <query>.
    • in scalar context, just returns the first <query>. first come first served, periodt.
  • 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 the color method 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> πŸ’Œ


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