| 1 |
NAME |
| 2 |
Color::Library - An easy-to-use and comprehensive named-color library |
| 3 |
|
| 4 |
VERSION |
| 5 |
version 0.021 |
| 6 |
|
| 7 |
SYNOPSIS |
| 8 |
use Color::Library; |
| 9 |
|
| 10 |
# Search for a sea blue color |
| 11 |
my $seablue = Color::Library->color("seablue"); |
| 12 |
|
| 13 |
# Search for a grey73 in the 'svg' and 'x11' dictionaries only |
| 14 |
my $grey73 = Color::Library->colour([qw/svg x11/] => "grey73"); |
| 15 |
|
| 16 |
# Find a bunch of colors at the same time |
| 17 |
my ($red, $green, $blue) = Color::Library->colors(qw/red green blue/); |
| 18 |
|
| 19 |
# Fetch the named color "aliceblue" from the SVG dictionary |
| 20 |
my $color = Color::Library->SVG->color("aliceblue"); |
| 21 |
|
| 22 |
# Prints out "aliceblue is #ff08ff" |
| 23 |
print $color->name, "is ", $color, "\n"; |
| 24 |
|
| 25 |
# Get a list of names in the svg dictionary |
| 26 |
my @names = Color::Library->SVG->names; |
| 27 |
|
| 28 |
# Get a list of colors in the x11 dictionary |
| 29 |
my @colors = Color::Library->dictionary('x11')->colors; |
| 30 |
|
| 31 |
DESCRIPTION |
| 32 |
Color::Library is an easy-to-use and comprehensive named-color |
| 33 |
dictionary. Currently provides coverage for www (svg, html, css) colors, |
| 34 |
x11 colors, and more. |
| 35 |
|
| 36 |
DICTIONARIES |
| 37 |
The following dictionaries are available in this distribution: |
| 38 |
|
| 39 |
Color::Library::Dictionary::SVG - Colors from the SVG specification |
| 40 |
Color::Library::Dictionary::X11 - Colors for the X11 Window System (rgb.txt) |
| 41 |
Color::Library::Dictionary::HTML - Colors from the HTML 4.0 specification |
| 42 |
Color::Library::Dictionary::IE - Colors recognized by Internet Explorer |
| 43 |
Color::Library::Dictionary::Mozilla - Colors recognized by Mozilla (ColorNames.txt) |
| 44 |
Color::Library::Dictionary::Netscape - Colors recognized by Netscape |
| 45 |
Color::Library::Dictionary::Windows - Colors from the Windows system palette |
| 46 |
Color::Library::Dictionary::VACCC - VisiBone Anglo-Centric Color Code |
| 47 |
Color::Library::Dictionary::NBS_ISCC - Centroids of the NBS/ISCC catalog |
| 48 |
Color::Library::Dictionary::NBS_ISCC::A - Dye Colors |
| 49 |
Color::Library::Dictionary::NBS_ISCC::B - Colour Terminology in Biology |
| 50 |
Color::Library::Dictionary::NBS_ISCC::F - Colors; (for) Ready-Mixed Paints |
| 51 |
Color::Library::Dictionary::NBS_ISCC::H - Horticultural Colour Charts |
| 52 |
Color::Library::Dictionary::NBS_ISCC::M - Dictionary of Color |
| 53 |
Color::Library::Dictionary::NBS_ISCC::P - Plochere Color System |
| 54 |
Color::Library::Dictionary::NBS_ISCC::R - Color Standards and Color Nomenclature |
| 55 |
Color::Library::Dictionary::NBS_ISCC::RC - Rock-Color Chart |
| 56 |
Color::Library::Dictionary::NBS_ISCC::S - Postage-Stamp Color Names |
| 57 |
Color::Library::Dictionary::NBS_ISCC::SC - Soil Color Charts |
| 58 |
Color::Library::Dictionary::NBS_ISCC::TC - Standard Color Card of America |
| 59 |
|
| 60 |
You can see a list of colors in any of these by reading their perldoc. |
| 61 |
For example: |
| 62 |
|
| 63 |
perldoc Color::Library::Dictionary::VACCC |
| 64 |
|
| 65 |
If you have any suggestions for more color dictionaries to integrate, |
| 66 |
contact me. |
| 67 |
|
| 68 |
METHODS |
| 69 |
$dictionary = Color::Library->dictionary( <dictionary_id> ) |
| 70 |
Returns a Color::Library::Dictionary object corresponding to |
| 71 |
<dictionary_id> |
| 72 |
|
| 73 |
@dictionaries = Color::Library->dictionaries |
| 74 |
@dictionaries = Color::Library->dictionaries( <dictionary_id>, |
| 75 |
<dictionary_id>, ... ) |
| 76 |
$dictionaries = Color::Library->dictionaries( <dictionary_id>, |
| 77 |
<dictionary_id>, ... ) |
| 78 |
In list context, returns a list of Color::Library::Dictionary |
| 79 |
objects (for each <dictionary_id> passed in |
| 80 |
|
| 81 |
In scalar context, returns a hash of Color::Library::Dictionary |
| 82 |
objects mapping a dictionary id to a dictionary |
| 83 |
|
| 84 |
When called without arguments, the method will return all |
| 85 |
dictionaries |
| 86 |
|
| 87 |
$color = Color::Library->color( <query> ) |
| 88 |
Returns a Color::Library::Color object found via <query> |
| 89 |
|
| 90 |
A query can be any of the following: |
| 91 |
|
| 92 |
color name |
| 93 |
A color name is like "blue" or "bleached-almond" |
| 94 |
|
| 95 |
color title |
| 96 |
A color title is like "Dark Green-Teal" |
| 97 |
|
| 98 |
color id |
| 99 |
A color id is in the form of <dictionary_id>:<color_name>, for |
| 100 |
example: "x11:azure1" |
| 101 |
|
| 102 |
color( <query>, <query>, ... ) |
| 103 |
In list context, returns a list of Color::Library::Color objects |
| 104 |
corresponding to each <query> |
| 105 |
|
| 106 |
In scalar context, just returns the first <query> |
| 107 |
|
| 108 |
color( <dictionaries>, <query>, ... ) |
| 109 |
If an array reference is passed as the first argument, then this |
| 110 |
indicates that the array is a list of dictionary ids to search |
| 111 |
through (in order): |
| 112 |
|
| 113 |
# Search in the svg and x11 dictionaries for a match |
| 114 |
my $blue = Color::Library->color([qw/svg x11/], "blue"); |
| 115 |
|
| 116 |
# Will not find "aquamarine1" in the svg dictionary, so it will try the x11 dictionary |
| 117 |
my $aquamarine1 = Color::Library->color([qw/svg x11/], "aquamarine1"); |
| 118 |
|
| 119 |
$color = Color::Library->colors |
| 120 |
$color = Color::Library->colour |
| 121 |
$color = Color::Library->colours |
| 122 |
All are aliases for the above color method |
| 123 |
|
| 124 |
ABOUT |
| 125 |
This package was inspired by Graphics::ColorNames, and covers much of |
| 126 |
the same ground. However, I found the Graphics::ColorNames interface |
| 127 |
difficult to use. I also wanted to list colors directly in the perldoc, |
| 128 |
which this package does. |
| 129 |
|
| 130 |
SEE ALSO |
| 131 |
Graphics::ColorNames |
| 132 |
|
| 133 |
AUTHOR |
| 134 |
Robert Krimen <[email protected]> |
| 135 |
|
| 136 |
COPYRIGHT AND LICENSE |
| 137 |
This software is copyright (c) 2011 by Robert Krimen. |
| 138 |
|
| 139 |
This is free software; you can redistribute it and/or modify it under |
| 140 |
the same terms as the Perl 5 programming language system itself. |
| 141 |
|