1Color::Library(3)     User Contributed Perl Documentation    Color::Library(3)
2
3
4

NAME

6       Color::Library - An easy-to-use and comprehensive named-color library
7

VERSION

9       version 0.021
10

SYNOPSIS

12           use Color::Library;
13
14           # Search for a sea blue color
15           my $seablue = Color::Library->color("seablue");
16
17           # Search for a grey73 in the 'svg' and 'x11' dictionaries only
18           my $grey73 = Color::Library->colour([qw/svg x11/] => "grey73");
19
20           # Find a bunch of colors at the same time
21           my ($red, $green, $blue) = Color::Library->colors(qw/red green blue/);
22
23           # Fetch the named color "aliceblue" from the SVG dictionary
24           my $color = Color::Library->SVG->color("aliceblue");
25
26           # Prints out "aliceblue is #ff08ff"
27           print $color->name, "is ", $color, "\n";
28
29           # Get a list of names in the svg dictionary
30           my @names = Color::Library->SVG->names;
31
32           # Get a list of colors in the x11 dictionary
33           my @colors = Color::Library->dictionary('x11')->colors;
34

DESCRIPTION

36       Color::Library is an easy-to-use and comprehensive named-color
37       dictionary. Currently provides coverage for www (svg, html, css)
38       colors, x11 colors, and more.
39

DICTIONARIES

41       The following dictionaries are available in this distribution:
42
43           Color::Library::Dictionary::SVG - Colors from the SVG specification
44           Color::Library::Dictionary::X11 - Colors for the X11 Window System (rgb.txt)
45           Color::Library::Dictionary::HTML - Colors from the HTML 4.0 specification
46           Color::Library::Dictionary::IE - Colors recognized by Internet Explorer
47           Color::Library::Dictionary::Mozilla - Colors recognized by Mozilla (ColorNames.txt)
48           Color::Library::Dictionary::Netscape - Colors recognized by Netscape
49           Color::Library::Dictionary::Windows - Colors from the Windows system palette
50           Color::Library::Dictionary::VACCC - VisiBone Anglo-Centric Color Code
51           Color::Library::Dictionary::NBS_ISCC - Centroids of the NBS/ISCC catalog
52           Color::Library::Dictionary::NBS_ISCC::A - Dye Colors
53           Color::Library::Dictionary::NBS_ISCC::B - Colour Terminology in Biology
54           Color::Library::Dictionary::NBS_ISCC::F - Colors; (for) Ready-Mixed Paints
55           Color::Library::Dictionary::NBS_ISCC::H - Horticultural Colour Charts
56           Color::Library::Dictionary::NBS_ISCC::M - Dictionary of Color
57           Color::Library::Dictionary::NBS_ISCC::P - Plochere Color System
58           Color::Library::Dictionary::NBS_ISCC::R - Color Standards and Color Nomenclature
59           Color::Library::Dictionary::NBS_ISCC::RC - Rock-Color Chart
60           Color::Library::Dictionary::NBS_ISCC::S - Postage-Stamp Color Names
61           Color::Library::Dictionary::NBS_ISCC::SC - Soil Color Charts
62           Color::Library::Dictionary::NBS_ISCC::TC - Standard Color Card of America
63
64       You can see a list of colors in any of these by reading their perldoc.
65       For example:
66
67           perldoc Color::Library::Dictionary::VACCC
68
69       If you have any suggestions for more color dictionaries to integrate,
70       contact me.
71

METHODS

73       $dictionary = Color::Library->dictionary( <dictionary_id> )
74           Returns a Color::Library::Dictionary object corresponding to
75           <dictionary_id>
76
77       @dictionaries = Color::Library->dictionaries
78       @dictionaries = Color::Library->dictionaries( <dictionary_id>,
79       <dictionary_id>, ... )
80       $dictionaries = Color::Library->dictionaries( <dictionary_id>,
81       <dictionary_id>, ... )
82           In list context, returns a list of Color::Library::Dictionary
83           objects (for each <dictionary_id> passed in
84
85           In scalar context, returns a hash of Color::Library::Dictionary
86           objects mapping a dictionary id to a dictionary
87
88           When called without arguments, the method will return all
89           dictionaries
90
91       $color = Color::Library->color( <query> )
92           Returns a Color::Library::Color object found via <query>
93
94           A query can be any of the following:
95
96           color name
97               A color name is like "blue" or "bleached-almond"
98
99           color title
100               A color title is like "Dark Green-Teal"
101
102           color id
103               A color id is in the form of <dictionary_id>:<color_name>, for
104               example: "x11:azure1"
105
106       color( <query>, <query>, ... )
107           In list context, returns a list of Color::Library::Color objects
108           corresponding to each <query>
109
110           In scalar context, just returns the first <query>
111
112       color( <dictionaries>, <query>, ... )
113           If an array reference is passed as the first argument, then this
114           indicates that the array is a list of dictionary ids to search
115           through (in order):
116
117               # Search in the svg and x11 dictionaries for a match
118               my $blue = Color::Library->color([qw/svg x11/], "blue");
119
120               # Will not find "aquamarine1" in the svg dictionary, so it will try the x11 dictionary
121               my $aquamarine1 = Color::Library->color([qw/svg x11/], "aquamarine1");
122
123       $color = Color::Library->colors
124       $color = Color::Library->colour
125       $color = Color::Library->colours
126           All are aliases for the above color method
127

ABOUT

129       This package was inspired by Graphics::ColorNames, and covers much of
130       the same ground. However, I found the Graphics::ColorNames interface
131       difficult to use. I also wanted to list colors directly in the perldoc,
132       which this package does.
133

SEE ALSO

135       Graphics::ColorNames
136

AUTHOR

138       Robert Krimen <robertkrimen@gmail.com>
139
141       This software is copyright (c) 2011 by Robert Krimen.
142
143       This is free software; you can redistribute it and/or modify it under
144       the same terms as the Perl 5 programming language system itself.
145
146
147
148perl v5.34.0                      2022-01-21                 Color::Library(3)
Impressum