Codebase list libgraphics-colornames-perl / f5069f3
Merge branch 'upstream' * upstream: New upstream version 3.5.0 Signed-off-by: Manoj Srivastava <srivasta@debian.org> Manoj Srivastava 3 years ago
52 changed file(s) with 3656 addition(s) and 2589 deletion(s). Raw diff Collapse all Expand all
+0
-41
Build.PL less more
0 use Module::Build;
1
2 my $build = Module::Build->new
3 (
4 module_name => 'Graphics::ColorNames',
5 license => 'perl',
6 requires => {
7 'perl' => '5.006',
8 'base' => 0,
9 # 'AutoLoader' => 0,
10 'Carp' => 0,
11 'DirHandle' => 0,
12 'Exporter' => 0,
13 'File::Spec' => 0,
14 'IO::File' => 0,
15 'Module::Load' => '0.10',
16 'Module::Loaded' => 0,
17 },
18 recommends => {
19 'Color::Library' => 0.02,
20 'Tie::Sub' => 0,
21 'Test::Pod::Coverage' => 0,
22 'Test::Pod' => 1.00,
23 'Test::Portability::Files' => 0,
24 'Pod::Readme' => 0.09,
25 },
26 build_requires => {
27 'FileHandle' => 0, # for testing
28 'Test::Exception' => 0,
29 'Test::More' => 0,
30 },
31 # autosplit => [
32 # 'lib/Graphics/ColorNames.pm',
33 # ],
34 create_readme => ($Module::Build::VERSION >= 0.2702),
35 create_makefile_pl => 'traditional',
36 dist_author => 'Robert Rothenberg <rrwo at cpan.org>',
37 sign => 0,
38 );
39
40 $build->create_build_script;
+349
-200
Changes less more
0 Revision history for Perl extension Graphics::ColorNames (with significant
1 updates noted by asterisks, '*'):
2
3 2.11 Thu Jan 10 2008
4 - updated version number for release
5 - minor changes of text format
6 - added fix for problems with Graphics::ColorNames::GrayScale
7
8 2.10_05 Tue Jan 8 2008
9 * checks if modules already loaded before re-loading them
10 (uses Module::Loaded for this)
11 - requires changed to load for dynamically loaded modules
12 - updated README
13
14 2.10_04 Sun Jan 6 2008
15 - reverted back to standard object-oriented style
16 - Tie::Sub is only loaded when a subroutine is used for scheme
17
18 2.10_03 Sat Jan 5 2008
19 - tests use Test::Exception to catch errors
20 - rewrite parts of documentation to emphasize object-oriented
21 interface rather than the tied interface
22 - implemented a proper DESTROY method
23 - misc code cleanup and reorganization
24
25 2.10_02 Fri Jan 4 2008
26 * added support for Color::Library dictionaries
27 - minor changes to error messages
28 - underscores in color names ignored
29 - auto-loading color names in object-oriented interface, e.g.
30 $obj->black()
31 - stubs for DESTROY and UNTIE methods
32 - 06-obj.t test more flexible
33 - pointless 01-ColourNames test removed
34 - more updates to documentation
35
36 2.10_01 Thu Dec 20 2007
37 * non-word characters (spaces, punctuation) now ignored in
38 color names
39 * smarter handling of comments in rgb.txt files
40 * significant rewrite to parts of the code, requires Tie::Sub
41 * rewritten how FIRSTKEY and NEXTKEY methods work
42 - better error handling
43 - minor updates to documentation
44 - typos in comments
45 - added better checking for minimum Perl version reqs
46 - added aliaes w/out punctuation in Netscape scheme
47
48 2.04 Mon Dec 17 2007
49 - fixed inconsistencies in Netscape color scheme
50
51 2.03 Mon Dec 17 2007
52 - fixed glitch with version test
53 - cleaned up format of text files
54 - removed unneeded dependency
0 Revision history for Graphics-ColorNames:
1
2 v3.5.0 2019-06-06 21:28:32+01:00 Europe/London
3 [Incompatabilities]
4 - Bumped minimum prerequisite to Perl v5.10.
5
6 [Documentation]
7 - Corrected typo.
8
9 - Updated copyright year.
10
11 v3.4.0 2018-11-18 19:12:44+00:00 Europe/London
12 [Incompatabilities]
13 - Autoloaded color name methods were removed.
14
15 v3.3.4 2018-11-11 15:12:53+00:00 Europe/London
16 [Documentation]
17 - Added a ROADMAP section for planned changes.
18
19 [Toolchain]
20 - Tweaks to dist.ini.
21
22 v3.3.3 2018-10-27 19:31:14+01:00 Europe/London
23 [Documentation]
24 - Fix typo in GCN::X POD.
25
26 v3.3.2 2018-10-27 17:32:56+01:00 Europe/London
27 [Bug Fixes]
28 - Fix VERSION class method, RT 127301.
29
30 [Toolchain]
31 - Tweaks to dist.ini for simplifying build.
32
33 v3.3.1 2018-10-24 16:03:19+01:00 Europe/London
34 [Tests]
35 - Fixed text dependencies on modules that have been moved to
36 separate distributions, RT 127430.
37
38 v3.3.0 2018-10-23 21:29:56+01:00 Europe/London
39 [Incompatabilities]
40 - The GCN::HTML and GCN::Windows schemes have been removed and
41 released as separate modules.
42
43 - The prefix is now ignored for hex method for invalid color names.
44
45 [Bug Fixes]
46 - Removed undef warning for unknown color names in hex and rgb methods.
47
48 [Documentation]
49 - Reorganized the documentation.
50
51 - Documented handling of unknown color names in hex and rgb methods.
52
53 - Added INSTALL file to the distribution.
54
55 [Tests]
56 - Reorganized and improved tests.
57
58 [Other]
59 - The tied and autoloading interfaces are deprecated.
60
61 - Added contributor to module metadata.
62
63 v3.2.1 2018-10-06 10:59:36+01:00 Europe/London
64 [Bug Fixes]
65 - Fix VERSION, RT 127301.
66
67 v3.2.0 2018-10-04 00:35:01+01:00 Europe/London
68 [Bug Fixes]
69 - Pass through RGB hexidecimals prefixed by "0x", as claimed
70 by the documentation.
71
72 - Fix ambiguity between modiles and filenames, RT 54500.
73
74 - Schema modules can be in any namespace.
75
76 [Enhancements]
77 - GCN::X color scheme updated to 2014-07-06 version.
78
79 [Incompatabilities]
80 - Filenames must now be absolute.
81
82 [Tests]
83 - Minor improvement in style of some tests.
84
85 v3.1.2 2018-10-01 23:14:34+01:00 Europe/London
86 [Tests]
87 - Removed dependency on GCN::Netscape, RT 127258.
88
89 v3.1.1 2018-10-01 17:49:09+01:00 Europe/London
90 [Documentation]
91 - Added note that the HTML color scheme is deprecated.
92
93 [Bug Fixes]
94 - Regexes test for ASCII digits only.
95
96 v3.1.0 2018-09-30 13:37:11+01:00 Europe/London
97 [Incompatabilities]
98 - The Netscape color scheme has been split out into a separate
99 release.
100
101 [Documentation]
102 - Use modern syntax in some of the examples.
103
104 - Updated contributor names.
105
106 v3.0.2 2018-09-28 17:54:49+01:00 Europe/London
107
108 [Documentation]
109 - Identify how to report bugs.
110
111 - Add note about the old SourceForge project for this module.
112
113 - Fixed abstract for Netscape module.
114
115 [Other]
116 - Tagged release with the RT bug database.
117
118 - Removed Windows line endings.
119
120 v3.0.1 2018-09-28 13:39:19+01:00 Europe/London
121 [Documentation]
122 - Added omitted Changes to v3.0.0.
123
124 [Tests]
125 - Removed unnecessary version tests.
126
127 [Toolchain]
128 - Use newer style of module exports.
129
130 [Other]
131 - Perltidied source.
132
133 v3.0.0 2018-09-28 00:00:12+01:00 Europe/London
134 [Documentation]
135 - Reformated Changes file.
136
137 - POD is built using Pod::Weaver.
138
139 - Removed outdated sections from POD.
140
141 - Added additional module(s) to SEE ALSO section.
142
143 [Tests]
144 - Removed QA tests that are handled by Dist::Zilla.
145
146 [Toolchain]
147 - Use Dist::Zilla to build distribution.
148
149 [Other Changes]
150 - Corrected typo in comment.
151
152 - Cleaned up whitespace in the source code.
153
154 2.11 2008-01-10
155 - updated version number for release
156 - minor changes of text format
157 - added fix for problems with Graphics::ColorNames::GrayScale
158
159 2.10_05 2008-01-08
160 - checks if modules already loaded before re-loading them
161 (uses Module::Loaded for this)
162 - requires changed to load for dynamically loaded modules
163 - updated README
164
165 2.10_04 2008-01-06
166 - reverted back to standard object-oriented style
167 - Tie::Sub is only loaded when a subroutine is used for scheme
168
169 2.10_03 2008-01-05
170 - tests use Test::Exception to catch errors
171 - rewrite parts of documentation to emphasize object-oriented
172 interface rather than the tied interface
173 - implemented a proper DESTROY method
174 - misc code cleanup and reorganization
175
176 2.10_02 2008-01-04
177 - added support for Color::Library dictionaries
178 - minor changes to error messages
179 - underscores in color names ignored
180 - auto-loading color names in object-oriented interface, e.g.
181 $obj->black()
182 - stubs for DESTROY and UNTIE methods
183 - 06-obj.t test more flexible
184 - pointless 01-ColourNames test removed
185 - more updates to documentation
186
187 2.10_01 2007-12-20
188 - non-word characters (spaces, punctuation) now ignored in
189 color names
190 - smarter handling of comments in rgb.txt files
191 - significant rewrite to parts of the code, requires Tie::Sub
192 - rewritten how FIRSTKEY and NEXTKEY methods work
193 - better error handling
194 - minor updates to documentation
195 - typos in comments
196 - added better checking for minimum Perl version reqs
197 - added aliaes w/out punctuation in Netscape scheme
198
199 2.04 2007-12-17
200 - fixed inconsistencies in Netscape color scheme
201
202 2.03 2007-12-17
203 - fixed glitch with version test
204 - cleaned up format of text files
205 - removed unneeded dependency
55206
56207 2.02 Sun Dec 16 2007
57 - renamed developer-related test scripts
58 - removed 90-prereqs.t (it wasn't working properly sometimes)
59 - added DEVEL_TESTS environment variable as requirement for
60 developer tests
61 - README generated from POD using Pod::Readme
62
63 2.01 Sun Dec 16 2007
64 - Changed versions of specific color schemes to match main module
65 * Removed Graphics::ColourNames from the distribution
66 - updated documentation for Netscape.pm
67
68 2.0_04 Tue Oct 24 2006
69 - fixed Pod::Coverage tests (RT#20923)
70 - various optimizations
71 - changed to use inside-out object scheme
72 - no longer signing code (too many problems w/Module::Signature)
73
74 2.0_03 Fri Apr 8 2005
75 - fixed bug with reading scheme from FileHandle type
76 - fixed glitch in pod-coverage test
77 - corrected version in Graphics::ColourNames
78 - added tests to check versions in sync
79
80 2.0_02 Thu Apr 7 2005
81 - lesser-used routines made into autoloaded methods
82 - added Test::Portabiity::Files test
83 - minor updates for Netscape theme
84 - added support for :utility export tag
85 - added support for :all export tag
86
87 2.0_01 Mon Apr 4 2005
88 - removed DSLIP information from POD, since it has little meaning
89 - tweaked code
90 - color scheme can be a module name
91 - fixed bug in Pod::Coverage test, uses Test::Pod::Coverage
92 * major change in how schemes are stored, which affects priority
93 when CODE scheme types are used
94 - can load rgb.txt from GLOB, FileHandle or IO::File
95 - references can be specified as possible schemes in constructor
96 - added public load_scheme method
97 - various optimizations and tweaks
98 - IO::File is loaded only as needed
99 - rgb.txt file must be radable to be loaded
100 - tweaked tests
101 - RGB passthrough now consistently returns lowercase values
102 - minor optimization in FETCH for RGB passthrough
103 - added all_schemes function to query schemes
104
105 1.06 Tue Mar 29 2005
106 - cleaned up tests
107 - added DSLIP information to POD
108 - added Test::Pod tests
208 - renamed developer-related test scripts
209 - removed 90-prereqs.t (it wasn't working properly sometimes)
210 - added DEVEL_TESTS environment variable as requirement for
211 developer tests
212 - README generated from POD using Pod::Readme
213
214 2.01 2007-12-16
215 - Changed versions of specific color schemes to match main module
216 - Removed Graphics::ColourNames from the distribution
217 - updated documentation for Netscape.pm
218
219 2.0_04 2006-10-24
220 - fixed Pod::Coverage tests (RT#20923)
221 - various optimizations
222 - changed to use inside-out object scheme
223 - no longer signing code (too many problems w/Module::Signature)
224
225 2.0_03 2005-04-08
226 - fixed bug with reading scheme from FileHandle type
227 - fixed glitch in pod-coverage test
228 - corrected version in Graphics::ColourNames
229 - added tests to check versions in sync
230
231 2.0_02 2005-04-07
232 - lesser-used routines made into autoloaded methods
233 - added Test::Portabiity::Files test
234 - minor updates for Netscape theme
235 - added support for :utility export tag
236 - added support for :all export tag
237
238 2.0_01 2005-04-04
239 - removed DSLIP information from POD, since it has little meaning
240 - tweaked code
241 - color scheme can be a module name
242 - fixed bug in Pod::Coverage test, uses Test::Pod::Coverage
243 - major change in how schemes are stored, which affects priority
244 when CODE scheme types are used
245 - can load rgb.txt from GLOB, FileHandle or IO::File
246 - references can be specified as possible schemes in constructor
247 - added public load_scheme method
248 - various optimizations and tweaks
249 - IO::File is loaded only as needed
250 - rgb.txt file must be radable to be loaded
251 - tweaked tests
252 - RGB passthrough now consistently returns lowercase values
253 - minor optimization in FETCH for RGB passthrough
254 - added all_schemes function to query schemes
255
256 1.06 2005-03-29
257 - cleaned up tests
258 - added DSLIP information to POD
259 - added Test::Pod tests
109260 - added Pod::Coverage tests
110 - minor documentation changes
111 - uses Test::Prereq to test distro prereqs
112 - added SIGNATURE to distribution
113
114 1.05 Fri Sep 3 2004
115 - correction to Graphics::ColourNames
116 - correction to README
117
118 1.04 Fri Sep 3 2004
119 - updates to POD
120 - a filehandle for a rgb.txt file can be specified
121
122 1.03 Thu Aug 26 2004
123 - hooks to support CODE scheme types (as with module
261 - minor documentation changes
262 - uses Test::Prereq to test distro prereqs
263 - added SIGNATURE to distribution
264
265 1.05 2004-09-04
266 - correction to Graphics::ColourNames
267 - correction to README
268
269 1.04 2004-09-03
270 - updates to POD
271 - a filehandle for a rgb.txt file can be specified
272
273 1.03 2004-08-26
274 - hooks to support CODE scheme types (as with module
124275 Graphics::ColorNames::GrayScale 2.00)
125276 - ColourNames.pm has same version of ColorNames.pm
126277
127 1.02 Tue Aug 24 2004
128 - added Graphics::ColourNames alias
129 - minor changes to ColorNames.pm
130
131 1.01 Wed Aug 18 2004
132 - corrected typo in REQUIREMENTS (wrong Perl version)
133 - uses Module::Load for improved dynamic loading
134 - EXISTS works across multiple color schemes
135 - bug in FETCH that returned key has been fixed
136
137 1.00 Sat Jul 31 2004
138 - changed version to 1.00 as release appears to be stable
139 - corrected bad link in POD
140
141 0.39_04 Mon Jul 26 2004
142 - rebuilt distribution with proper META.yml
143
144 0.39_03 22 Jul 2004
145 - added required rgb.txt for tests to MANIFEST and distro
146
147 0.39_02 22 Jul 2004
148 * now requires Perl 5.6.0
149 - uses IO::File
150 - option to parse an rgb.txt file
151 - removed TODO from distribution
152 - Netscape.pm, HTML.pm and Windows.pm warnings enabled
153 - additions and corrections in POD
154
155 0.39_01 21 Jul 2004
156 - added Build.PL to distribution
157 - added hex() and rgb() methods
158 - created object-oriented interface
159 - additions and corrections in POD
160
161 0.32 5 Dec 2002
162 - fixed inconsistencies with grey/gray spellings in X.pm
163 - added note in POD about using rt.cpan.org for bug reports
164 - minor changes in POD for Netscape.pm
278 1.02 2004-08-24
279 - added Graphics::ColourNames alias
280 - minor changes to ColorNames.pm
281
282 1.01 2004-08-18
283 - corrected typo in REQUIREMENTS (wrong Perl version)
284 - uses Module::Load for improved dynamic loading
285 - EXISTS works across multiple color schemes
286 - bug in FETCH that returned key has been fixed
287
288 1.00 2004-07-31
289 - changed version to 1.00 as release appears to be stable
290 - corrected bad link in POD
291
292 0.39_04 2004-07-26
293 - rebuilt distribution with proper META.yml
294
295 0.39_03 2004-07-22
296 - added required rgb.txt for tests to MANIFEST and distro
297
298 0.39_02 2004-07-22
299 - now requires Perl 5.6.0
300 - uses IO::File
301 - option to parse an rgb.txt file
302 - removed TODO from distribution
303 - Netscape.pm, HTML.pm and Windows.pm warnings enabled
304 - additions and corrections in POD
305
306 0.39_01 2004-07-21
307 - added Build.PL to distribution
308 - added hex() and rgb() methods
309 - created object-oriented interface
310 - additions and corrections in POD
311
312 0.32 2002-12-05
313 - fixed inconsistencies with grey/gray spellings in X.pm
314 - added note in POD about using rt.cpan.org for bug reports
315 - minor changes in POD for Netscape.pm
165316 - added TODO file
166317
167 0.31 23 Oct 2002
168 - fixed mispelling of "fuchsia" in HTML.pm
169
170 0.30 4 Oct 2001
171 - fixed bug with non-existent color names
172 - corrected some typos in and updated the documentation
173 - added multiple color naming schemes
174 - when passed a value in the form of '#000000', returns that value
175
176 0.24 28 Apr 2001
177 - fixed colors in X.pm (such as some 'green') defined as 0x000000
178 - removed duplicate grays (ie, 'gray0') from X.pm
179 - renamed test suite files to enforce testing order
180 - v0.23 mistakenly dated 17 Mar instead of 17 April
181
182 0.23 17 Apr 2001
183 - X-Windows color names now from rgb.txt (includes names with
184 spaces, such as 'alice blue' as well as 'aliceblue')
185 - Added Netscape color naming scheme
186
187 0.22 15 Mar 2001
188 - added example on how to add your own naming schema
189 - schema files (X.pm, HTML.pm, Windows.pm) were stored in the
190 wrong subdirectories
191 - removed test.pl and double-testing
192
193 0.21 12 Mar 2001
194 - fixed an issue with Test::Harness expecting t/*.t tests
195
196 0.20 11 Mar 2001
197 - no longer a Tie::Hash
198 - additional example in POD
199 - added Test::Harness and a better test suite
200 - commented-out 'use warnings' in modules
201 - addition of tuple2hex function
202 - changed the way files are included in the distribution
203
204 0.10 19 Feb 2001
205 - original (experimental) version released
206
207
318 0.31 2002-10-23
319 - fixed mispelling of "fuchsia" in HTML.pm
320
321 0.30 2001-10-04
322 - fixed bug with non-existent color names
323 - corrected some typos in and updated the documentation
324 - added multiple color naming schemes
325 - when passed a value in the form of '#000000', returns that value
326
327 0.24 2001-04-28
328 - fixed colors in X.pm (such as some 'green') defined as 0x000000
329 - removed duplicate grays (ie, 'gray0') from X.pm
330 - renamed test suite files to enforce testing order
331 - v0.23 mistakenly dated 17 Mar instead of 17 April
332
333 0.23 2001-04-17
334 - X-Windows color names now from rgb.txt (includes names with
335 spaces, such as 'alice blue' as well as 'aliceblue')
336 - Added Netscape color naming scheme
337
338 0.22 2001-03-15
339 - added example on how to add your own naming schema
340 - schema files (X.pm, HTML.pm, Windows.pm) were stored in the
341 wrong subdirectories
342 - removed test.pl and double-testing
343
344 0.21 2001-03-12
345 - fixed an issue with Test::Harness expecting t/*.t tests
346
347 0.20 2001-03-11
348 - no longer a Tie::Hash
349 - additional example in POD
350 - added Test::Harness and a better test suite
351 - commented-out 'use warnings' in modules
352 - addition of tuple2hex function
353 - changed the way files are included in the distribution
354
355 0.10 2001-02-19
356 - original (experimental) version released
0 This is the Perl distribution Graphics-ColorNames.
1
2 Installing Graphics-ColorNames is straightforward.
3
4 ## Installation with cpanm
5
6 If you have cpanm, you only need one line:
7
8 % cpanm Graphics::ColorNames
9
10 If it does not have permission to install modules to the current perl, cpanm
11 will automatically set up and install to a local::lib in your home directory.
12 See the local::lib documentation (https://metacpan.org/pod/local::lib) for
13 details on enabling it in your environment.
14
15 ## Installing with the CPAN shell
16
17 Alternatively, if your CPAN shell is set up, you should just be able to do:
18
19 % cpan Graphics::ColorNames
20
21 ## Manual installation
22
23 As a last resort, you can manually install it. Download the tarball, untar it,
24 install configure prerequisites (see below), then build it:
25
26 % perl Makefile.PL
27 % make && make test
28
29 Then install it:
30
31 % make install
32
33 On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.
34
35 If your perl is system-managed, you can create a local::lib in your home
36 directory to install modules to. For details, see the local::lib documentation:
37 https://metacpan.org/pod/local::lib
38
39 The prerequisites of this distribution will also have to be installed manually. The
40 prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
41 by running the manual build process described above.
42
43 ## Configure Prerequisites
44
45 This distribution requires other modules to be installed before this
46 distribution's installer can be run. They can be found under the
47 "configure_requires" key of META.yml or the
48 "{prereqs}{configure}{requires}" key of META.json.
49
50 ## Other Prerequisites
51
52 This distribution may require additional modules to be installed after running
53 Makefile.PL.
54 Look for prerequisites in the following phases:
55
56 * to run make, PHASE = build
57 * to use the module code itself, PHASE = runtime
58 * to run tests, PHASE = test
59
60 They can all be found in the "PHASE_requires" key of MYMETA.yml or the
61 "{prereqs}{PHASE}{requires}" key of MYMETA.json.
62
63 ## Documentation
64
65 Graphics-ColorNames documentation is available as POD.
66 You can run `perldoc` from a shell to read the documentation:
67
68 % perldoc Graphics::ColorNames
69
70 For more information on installing Perl modules via CPAN, please see:
71 https://www.cpan.org/modules/INSTALL.html
0 This software is Copyright (c) 2001-2019 by Robert Rothenberg.
1
2 This is free software, licensed under:
3
4 The Artistic License 2.0 (GPL Compatible)
5
6 The Artistic License 2.0
7
8 Copyright (c) 2000-2006, The Perl Foundation.
9
10 Everyone is permitted to copy and distribute verbatim copies
11 of this license document, but changing it is not allowed.
12
13 Preamble
14
15 This license establishes the terms under which a given free software
16 Package may be copied, modified, distributed, and/or redistributed.
17 The intent is that the Copyright Holder maintains some artistic
18 control over the development of that Package while still keeping the
19 Package available as open source and free software.
20
21 You are always permitted to make arrangements wholly outside of this
22 license directly with the Copyright Holder of a given Package. If the
23 terms of this license do not permit the full use that you propose to
24 make of the Package, you should contact the Copyright Holder and seek
25 a different licensing arrangement.
26
27 Definitions
28
29 "Copyright Holder" means the individual(s) or organization(s)
30 named in the copyright notice for the entire Package.
31
32 "Contributor" means any party that has contributed code or other
33 material to the Package, in accordance with the Copyright Holder's
34 procedures.
35
36 "You" and "your" means any person who would like to copy,
37 distribute, or modify the Package.
38
39 "Package" means the collection of files distributed by the
40 Copyright Holder, and derivatives of that collection and/or of
41 those files. A given Package may consist of either the Standard
42 Version, or a Modified Version.
43
44 "Distribute" means providing a copy of the Package or making it
45 accessible to anyone else, or in the case of a company or
46 organization, to others outside of your company or organization.
47
48 "Distributor Fee" means any fee that you charge for Distributing
49 this Package or providing support for this Package to another
50 party. It does not mean licensing fees.
51
52 "Standard Version" refers to the Package if it has not been
53 modified, or has been modified only in ways explicitly requested
54 by the Copyright Holder.
55
56 "Modified Version" means the Package, if it has been changed, and
57 such changes were not explicitly requested by the Copyright
58 Holder.
59
60 "Original License" means this Artistic License as Distributed with
61 the Standard Version of the Package, in its current version or as
62 it may be modified by The Perl Foundation in the future.
63
64 "Source" form means the source code, documentation source, and
65 configuration files for the Package.
66
67 "Compiled" form means the compiled bytecode, object code, binary,
68 or any other form resulting from mechanical transformation or
69 translation of the Source form.
70
71
72 Permission for Use and Modification Without Distribution
73
74 (1) You are permitted to use the Standard Version and create and use
75 Modified Versions for any purpose without restriction, provided that
76 you do not Distribute the Modified Version.
77
78
79 Permissions for Redistribution of the Standard Version
80
81 (2) You may Distribute verbatim copies of the Source form of the
82 Standard Version of this Package in any medium without restriction,
83 either gratis or for a Distributor Fee, provided that you duplicate
84 all of the original copyright notices and associated disclaimers. At
85 your discretion, such verbatim copies may or may not include a
86 Compiled form of the Package.
87
88 (3) You may apply any bug fixes, portability changes, and other
89 modifications made available from the Copyright Holder. The resulting
90 Package will still be considered the Standard Version, and as such
91 will be subject to the Original License.
92
93
94 Distribution of Modified Versions of the Package as Source
95
96 (4) You may Distribute your Modified Version as Source (either gratis
97 or for a Distributor Fee, and with or without a Compiled form of the
98 Modified Version) provided that you clearly document how it differs
99 from the Standard Version, including, but not limited to, documenting
100 any non-standard features, executables, or modules, and provided that
101 you do at least ONE of the following:
102
103 (a) make the Modified Version available to the Copyright Holder
104 of the Standard Version, under the Original License, so that the
105 Copyright Holder may include your modifications in the Standard
106 Version.
107
108 (b) ensure that installation of your Modified Version does not
109 prevent the user installing or running the Standard Version. In
110 addition, the Modified Version must bear a name that is different
111 from the name of the Standard Version.
112
113 (c) allow anyone who receives a copy of the Modified Version to
114 make the Source form of the Modified Version available to others
115 under
116
117 (i) the Original License or
118
119 (ii) a license that permits the licensee to freely copy,
120 modify and redistribute the Modified Version using the same
121 licensing terms that apply to the copy that the licensee
122 received, and requires that the Source form of the Modified
123 Version, and of any works derived from it, be made freely
124 available in that license fees are prohibited but Distributor
125 Fees are allowed.
126
127
128 Distribution of Compiled Forms of the Standard Version
129 or Modified Versions without the Source
130
131 (5) You may Distribute Compiled forms of the Standard Version without
132 the Source, provided that you include complete instructions on how to
133 get the Source of the Standard Version. Such instructions must be
134 valid at the time of your distribution. If these instructions, at any
135 time while you are carrying out such distribution, become invalid, you
136 must provide new instructions on demand or cease further distribution.
137 If you provide valid instructions or cease distribution within thirty
138 days after you become aware that the instructions are invalid, then
139 you do not forfeit any of your rights under this license.
140
141 (6) You may Distribute a Modified Version in Compiled form without
142 the Source, provided that you comply with Section 4 with respect to
143 the Source of the Modified Version.
144
145
146 Aggregating or Linking the Package
147
148 (7) You may aggregate the Package (either the Standard Version or
149 Modified Version) with other packages and Distribute the resulting
150 aggregation provided that you do not charge a licensing fee for the
151 Package. Distributor Fees are permitted, and licensing fees for other
152 components in the aggregation are permitted. The terms of this license
153 apply to the use and Distribution of the Standard or Modified Versions
154 as included in the aggregation.
155
156 (8) You are permitted to link Modified and Standard Versions with
157 other works, to embed the Package in a larger work of your own, or to
158 build stand-alone binary or bytecode versions of applications that
159 include the Package, and Distribute the result without restriction,
160 provided the result does not expose a direct interface to the Package.
161
162
163 Items That are Not Considered Part of a Modified Version
164
165 (9) Works (including, but not limited to, modules and scripts) that
166 merely extend or make use of the Package, do not, by themselves, cause
167 the Package to be a Modified Version. In addition, such works are not
168 considered parts of the Package itself, and are not subject to the
169 terms of this license.
170
171
172 General Provisions
173
174 (10) Any use, modification, and distribution of the Standard or
175 Modified Versions is governed by this Artistic License. By using,
176 modifying or distributing the Package, you accept this license. Do not
177 use, modify, or distribute the Package, if you do not accept this
178 license.
179
180 (11) If your Modified Version has been derived from a Modified
181 Version made by someone other than you, you are nevertheless required
182 to ensure that your Modified Version complies with the requirements of
183 this license.
184
185 (12) This license does not grant you the right to use any trademark,
186 service mark, tradename, or logo of the Copyright Holder.
187
188 (13) This license includes the non-exclusive, worldwide,
189 free-of-charge patent license to make, have made, use, offer to sell,
190 sell, import and otherwise transfer the Package with respect to any
191 patent claims licensable by the Copyright Holder that are necessarily
192 infringed by the Package. If you institute patent litigation
193 (including a cross-claim or counterclaim) against any party alleging
194 that the Package constitutes direct or contributory patent
195 infringement, then this Artistic License to you shall terminate on the
196 date that such litigation is filed.
197
198 (14) Disclaimer of Warranty:
199 THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
200 IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
201 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
202 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
203 LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
204 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
205 DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
206 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 Build.PL
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
11 Changes
2 INSTALL
3 LICENSE
4 MANIFEST
5 MANIFEST.SKIP
6 META.json
7 META.yml
28 Makefile.PL
3 MANIFEST
4 META.yml
5 README
6 t/01-ColorNames.t
7 t/01-version.t
9 README.md
10 cpanfile
11 dist.ini
12 lib/Graphics/ColorNames.pm
13 lib/Graphics/ColorNames/X.pm
14 t-etc/rgb.txt
15 t/00-report-prereqs.dd
16 t/00-report-prereqs.t
17 t/01-exports.t
818 t/02-X.t
9 t/03-HTML.t
10 t/04-Windows.t
11 t/05-Netscape.t
12 t/06-obj.t
19 t/03-oo.t
20 t/04-precedence.t
21 t/05-tied.t
1322 t/07-file.t
1423 t/08-filehandle.t
1524 t/09-colorlibrary.t
1625 t/10-sub.t
17 t/90-file-port.t
18 t/90-pod-coverage.t
19 t/90-pod.t
20 t/rgb.txt
21 lib/Graphics/ColorNames.pm
22 lib/Graphics/ColorNames/HTML.pm
23 lib/Graphics/ColorNames/Netscape.pm
24 lib/Graphics/ColorNames/Windows.pm
25 lib/Graphics/ColorNames/X.pm
26 t/author-eof.t
27 t/author-eol.t
28 t/author-minimum-version.t
29 t/author-no-tabs.t
30 t/author-pod-linkcheck.t
31 t/author-pod-syntax.t
32 t/author-portability.t
33 t/lib/Graphics/ColorNames/Test.pm
34 t/release-check-manifest.t
35 t/release-fixme.t
36 t/release-trailing-space.t
37 weaver.ini
0 .*~$
1 .*\.(bak|old)$
2 \.git/.*
3 \.gitignore
4
5 # Begin standard Module::Manifest::Skip list:
6
7 # ExtUtils::MakeMaker
8 ^blib/
9 ^blibdirs$
10 ^blibdirs\.ts$
11 ^bpm_to_blib\.ts$
12 ^Makefile$
13 ^Makefile\.old$
14 ^MakeMaker-\d
15 ^MANIFEST\.bak$
16 # ^MANIFEST\.SKIP$
17 ^MYMETA\.
18 ^pm_to_blib$
19 ^pod2htm.*
20
21 # Module::Build
22 ^Build$
23 ^_build/
24 ^Build.bat$
25 ^Build.COM$
26 ^BUILD.COM$
27 ^build.com$
28
29 # Revision Control
30 \bCVS\b
31 \b.cvsignore\b
32 \b_darcs\b
33 \B\.git\b
34 \B\.gitignore\b
35 \B\.gitmodules\b
36 \B\.hg\b
37 \B\.hgignore\b
38 \B\.hgtags\b
39 \bRCS\b
40 \bSCCS\b
41 \B\.svn\b
42 ,v$
43 ,B$
44 ,D$
45 \baegis.log$
46
47 # Author Extras
48 ^inc/.*\.pod$
49 ^pkg/
50 # ^xt/
51 # ^dist.ini$
52
53 # Editors
54 ~$
55 \#$
56 \b\.#
57 \.kpf$
58 \.sw[pmno]$
59 ^\.vimrc$
60
61 # OS X
62 \.DS_Store$
63 ^\.Trash/
64 \B\._
65
66 # VMS
67 \bDescrip.MMS$
68 \bDESCRIP.MMS$
69 \bdescrip.mms$
70
71 # Development
72 ^benchmarks/
73 ^core$
74 ^cover_db\b
75 ^covered\b
76 ^debian/
77 ^devel\.
78 ^.devel-local$
79 ^out$
80 ^tmon.out$
81 ^old/
82 ^Old/
83
84 # Author Notes
85 ^notes
86 ^todo
87 ^ToDo$
88
89 # Common Junk Files
90 \.bak$
91 \.diff$
92 ^foo\b.*
93 \.old$
94 \.orig$
95 \.patch$
96 \.rej$
97 \.tdy$
98 \.tmp$
99 ^\w$
100 \.ttc$
101 \.pmc$
102
103 # Added by Dist::Zilla::Plugin::Generate::ManifestSkip
104 \.build/
105 Graphics-ColorNames-.*/
106 Graphics-ColorNames-.*\.tar\.gz
107 \.mailmap$
108 perltidy\.(LOG|ERR)
109 fatlib/
110 cpanfile\.snapshot$
111 local/
0 {
1 "abstract" : "defines RGB values for common color names",
2 "author" : [
3 "Robert Rothenberg <rrwo@cpan.org>"
4 ],
5 "dynamic_config" : 0,
6 "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
7 "keywords" : [
8 "color"
9 ],
10 "license" : [
11 "artistic_2"
12 ],
13 "meta-spec" : {
14 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
15 "version" : 2
16 },
17 "name" : "Graphics-ColorNames",
18 "prereqs" : {
19 "configure" : {
20 "requires" : {
21 "ExtUtils::MakeMaker" : "0"
22 }
23 },
24 "develop" : {
25 "requires" : {
26 "Test::EOF" : "0",
27 "Test::EOL" : "0",
28 "Test::MinimumVersion" : "0",
29 "Test::More" : "0.88",
30 "Test::NoTabs" : "0",
31 "Test::Pod" : "1.41",
32 "Test::Pod::LinkCheck" : "0",
33 "Test::Portability::Files" : "0",
34 "Test::TrailingSpace" : "0.0203"
35 }
36 },
37 "runtime" : {
38 "requires" : {
39 "Exporter" : "5.57",
40 "Module::Load" : "0.10",
41 "Module::Loaded" : "0",
42 "perl" : "v5.10.0",
43 "version" : "0"
44 }
45 },
46 "test" : {
47 "recommends" : {
48 "CPAN::Meta" : "2.120900"
49 },
50 "requires" : {
51 "File::Spec" : "0",
52 "FileHandle" : "0",
53 "IO::File" : "0",
54 "Module::Metadata" : "0",
55 "Test::Exception" : "0",
56 "Test::More" : "0",
57 "Test::Most" : "0",
58 "constant" : "0",
59 "lib" : "0",
60 "perl" : "v5.10.0"
61 }
62 }
63 },
64 "provides" : {
65 "Graphics::ColorNames" : {
66 "file" : "lib/Graphics/ColorNames.pm",
67 "version" : "v3.5.0"
68 },
69 "Graphics::ColorNames::X" : {
70 "file" : "lib/Graphics/ColorNames/X.pm",
71 "version" : "v3.5.0"
72 }
73 },
74 "release_status" : "stable",
75 "resources" : {
76 "bugtracker" : {
77 "mailto" : "bug-Graphics-ColorNames@rt.cpan.org",
78 "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames"
79 },
80 "repository" : {
81 "type" : "git",
82 "url" : "git://github.com/robrwo/Graphics-ColorNames.git",
83 "web" : "https://github.com/robrwo/Graphics-ColorNames"
84 }
85 },
86 "version" : "v3.5.0",
87 "x_authority" : "cpan:RRWO",
88 "x_contributors" : [
89 "Alan D. Salewski <alans@cji.com>",
90 "Steve Pomeroy <xavier@cpan.org>",
91 "\"chemboy\" <chemboy@perlmonk.org>",
92 "Magnus Cedergren <magnus@mbox604.swipnet.se>",
93 "Gary Vollink <gary@vollink.com>",
94 "Claus F\u00e4rber <cfaerber@cpan.org>",
95 "Andreas J. K\u00f6nig <andk@cpan.org>",
96 "Slaven Rezi\u0107 <slaven@rezic.de>"
97 ],
98 "x_generated_by_perl" : "v5.28.1",
99 "x_serialization_backend" : "Cpanel::JSON::XS version 4.11"
100 }
101
00 ---
1 abstract: 'defines RGB values for common color names'
2 author:
3 - 'Robert Rothenberg <rrwo@cpan.org>'
4 build_requires:
5 File::Spec: '0'
6 FileHandle: '0'
7 IO::File: '0'
8 Module::Metadata: '0'
9 Test::Exception: '0'
10 Test::More: '0'
11 Test::Most: '0'
12 constant: '0'
13 lib: '0'
14 perl: v5.10.0
15 configure_requires:
16 ExtUtils::MakeMaker: '0'
17 dynamic_config: 0
18 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
19 keywords:
20 - color
21 license: artistic_2
22 meta-spec:
23 url: http://module-build.sourceforge.net/META-spec-v1.4.html
24 version: '1.4'
125 name: Graphics-ColorNames
2 version: 2.11
3 author:
4 - 'Robert Rothenberg <rrwo at cpan.org>'
5 abstract: defines RGB values for common color names
6 license: perl
7 resources:
8 license: http://dev.perl.org/licenses/
9 requires:
10 Carp: 0
11 DirHandle: 0
12 Exporter: 0
13 File::Spec: 0
14 IO::File: 0
15 Module::Load: 0.10
16 Module::Loaded: 0
17 base: 0
18 perl: 5.006
19 build_requires:
20 FileHandle: 0
21 Test::Exception: 0
22 Test::More: 0
23 recommends:
24 Color::Library: 0.02
25 Pod::Readme: 0.09
26 Test::Pod: 1
27 Test::Pod::Coverage: 0
28 Test::Portability::Files: 0
29 Tie::Sub: 0
3026 provides:
3127 Graphics::ColorNames:
3228 file: lib/Graphics/ColorNames.pm
33 version: 2.11
34 Graphics::ColorNames::HTML:
35 file: lib/Graphics/ColorNames/HTML.pm
36 version: 2.11
37 Graphics::ColorNames::Netscape:
38 file: lib/Graphics/ColorNames/Netscape.pm
39 version: 2.11
40 Graphics::ColorNames::Windows:
41 file: lib/Graphics/ColorNames/Windows.pm
42 version: 2.11
29 version: v3.5.0
4330 Graphics::ColorNames::X:
4431 file: lib/Graphics/ColorNames/X.pm
45 version: 2.11
46 generated_by: Module::Build version 0.2808
47 meta-spec:
48 url: http://module-build.sourceforge.net/META-spec-v1.2.html
49 version: 1.2
32 version: v3.5.0
33 requires:
34 Exporter: '5.57'
35 Module::Load: '0.10'
36 Module::Loaded: '0'
37 perl: v5.10.0
38 version: '0'
39 resources:
40 bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames
41 repository: git://github.com/robrwo/Graphics-ColorNames.git
42 version: v3.5.0
43 x_authority: cpan:RRWO
44 x_contributors:
45 - 'Alan D. Salewski <alans@cji.com>'
46 - 'Steve Pomeroy <xavier@cpan.org>'
47 - '"chemboy" <chemboy@perlmonk.org>'
48 - 'Magnus Cedergren <magnus@mbox604.swipnet.se>'
49 - 'Gary Vollink <gary@vollink.com>'
50 - 'Claus Färber <cfaerber@cpan.org>'
51 - 'Andreas J. König <andk@cpan.org>'
52 - 'Slaven Rezić <slaven@rezic.de>'
53 x_generated_by_perl: v5.28.1
54 x_serialization_backend: 'YAML::Tiny version 1.73'
0 # Note: this file was auto-generated by Module::Build::Compat version 0.03
0 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
1 use strict;
2 use warnings;
3
4 use 5.010000;
5
16 use ExtUtils::MakeMaker;
2 WriteMakefile
3 (
4 'PL_FILES' => {},
5 'INSTALLDIRS' => 'site',
6 'NAME' => 'Graphics::ColorNames',
7 'EXE_FILES' => [],
8 'VERSION_FROM' => 'lib/Graphics/ColorNames.pm',
9 'PREREQ_PM' => {
10 'base' => 0,
11 'Test::Exception' => 0,
12 'IO::File' => 0,
13 'File::Spec' => 0,
14 'FileHandle' => 0,
15 'Exporter' => 0,
16 'Carp' => 0,
17 'Test::More' => 0,
18 'Module::Loaded' => 0,
19 'Module::Load' => '0.10',
20 'DirHandle' => 0
21 }
22 )
23 ;
7
8 my %WriteMakefileArgs = (
9 "ABSTRACT" => "defines RGB values for common color names",
10 "AUTHOR" => "Robert Rothenberg <rrwo\@cpan.org>",
11 "CONFIGURE_REQUIRES" => {
12 "ExtUtils::MakeMaker" => 0
13 },
14 "DISTNAME" => "Graphics-ColorNames",
15 "LICENSE" => "artistic_2",
16 "MIN_PERL_VERSION" => "5.010000",
17 "NAME" => "Graphics::ColorNames",
18 "PREREQ_PM" => {
19 "Exporter" => "5.57",
20 "Module::Load" => "0.10",
21 "Module::Loaded" => 0,
22 "version" => 0
23 },
24 "TEST_REQUIRES" => {
25 "File::Spec" => 0,
26 "FileHandle" => 0,
27 "IO::File" => 0,
28 "Module::Metadata" => 0,
29 "Test::Exception" => 0,
30 "Test::More" => 0,
31 "Test::Most" => 0,
32 "constant" => 0,
33 "lib" => 0
34 },
35 "VERSION" => "v3.5.0",
36 "test" => {
37 "TESTS" => "t/*.t"
38 }
39 );
40
41
42 my %FallbackPrereqs = (
43 "Exporter" => "5.57",
44 "File::Spec" => 0,
45 "FileHandle" => 0,
46 "IO::File" => 0,
47 "Module::Load" => "0.10",
48 "Module::Loaded" => 0,
49 "Module::Metadata" => 0,
50 "Test::Exception" => 0,
51 "Test::More" => 0,
52 "Test::Most" => 0,
53 "constant" => 0,
54 "lib" => 0,
55 "version" => 0
56 );
57
58
59 unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
60 delete $WriteMakefileArgs{TEST_REQUIRES};
61 delete $WriteMakefileArgs{BUILD_REQUIRES};
62 $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
63 }
64
65 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
66 unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
67
68 WriteMakefile(%WriteMakefileArgs);
+0
-135
README less more
0 NAME
1 Graphics::ColorNames - defines RGB values for common color names
2
3 REQUIREMENTS
4 `Graphics::ColorNames' should work on Perl 5.6.0. It requires the
5 following non-core (depending on your Perl version) modules:
6
7 Module::Load
8 Module::Loaded
9
10 The following modules are not required for using most features but are
11 recommended:
12
13 Color::Library
14 Tie::Sub
15
16 Installation requires the following testing modules:
17
18 Test::Exception
19 Test::More
20
21 If the `DEVEL_TESTS' environment variable is set, the tests will also
22 use the following modules for running developer tests, if they are
23 installed:
24
25 Test::Pod
26 Test::Pod::Coverage
27 Test::Portability::Files
28
29 The developer tests are for quality-control purposes.
30
31 INSTALLATION
32 Installation can be done using the traditional Makefile.PL or the newer
33 Build.PL methods.
34
35 Using Makefile.PL:
36
37 perl Makefile.PL
38 make test
39 make install
40
41 (On Windows platforms you should use `nmake' instead.)
42
43 Using Build.PL (if you have Module::Build installed):
44
45 perl Build.PL
46 perl Build test
47 perl Build install
48
49 SYNOPSIS
50 use Graphics::ColorNames 2.10;
51
52 $po = new Graphics::ColorNames(qw( X ));
53
54 $rgb = $po->hex('green'); # returns '00ff00'
55 $rgb = $po->hex('green', '0x'); # returns '0x00ff00'
56 $rgb = $po->hex('green', '#'); # returns '#00ff00'
57
58 $rgb = $po->rgb('green'); # returns '0,255,0'
59 @rgb = $po->rgb('green'); # returns (0, 255, 0)
60
61 $rgb = $po->green; # same as $po->hex('green');
62
63 tie %ph, 'Graphics::ColorNames', (qw( X ));
64
65 $rgb = $ph{green}; # same as $po->hex('green');
66
67 DESCRIPTION
68 This module provides a common interface for obtaining the RGB values of
69 colors by standard names. The intention is to (1) provide a common
70 module that authors can use with other modules to specify colors by
71 name; and (2) free module authors from having to "re-invent the wheel"
72 whenever they decide to give the users the option of specifying a color
73 by name rather than RGB value.
74
75 See the module POD for complete documentation.
76
77 REVISION HISTORY
78 Changes since the last release:
79
80 2.11 Thu Jan 10 2008
81 - updated version number for release
82 - minor changes of text format
83 - added fix for problems with Graphics::ColorNames::GrayScale
84
85 2.10_05 Tue Jan 8 2008
86 * checks if modules already loaded before re-loading them
87 (uses Module::Loaded for this)
88 - requires changed to load for dynamically loaded modules
89 - updated README
90
91 2.10_04 Sun Jan 6 2008
92 - reverted back to standard object-oriented style
93 - Tie::Sub is only loaded when a subroutine is used for scheme
94
95 2.10_03 Sat Jan 5 2008
96 - tests use Test::Exception to catch errors
97 - rewrite parts of documentation to emphasize object-oriented
98 interface rather than the tied interface
99 - implemented a proper DESTROY method
100 - misc code cleanup and reorganization
101
102 2.10_02 Fri Jan 4 2008
103 * added support for Color::Library dictionaries
104 - minor changes to error messages
105 - underscores in color names ignored
106 - auto-loading color names in object-oriented interface, e.g.
107 $obj->black()
108 - stubs for DESTROY and UNTIE methods
109 - 06-obj.t test more flexible
110 - pointless 01-ColourNames test removed
111 - more updates to documentation
112
113 2.10_01 Thu Dec 20 2007
114 * non-word characters (spaces, punctuation) now ignored in
115 color names
116 * smarter handling of comments in rgb.txt files
117 * significant rewrite to parts of the code, requires Tie::Sub
118 * rewritten how FIRSTKEY and NEXTKEY methods work
119 - better error handling
120 - minor updates to documentation
121 - typos in comments
122 - added better checking for minimum Perl version reqs
123 - added aliaes w/out punctuation in Netscape scheme
124
125 More details can be found in the Changes file.
126
127 AUTHOR
128 Robert Rothenberg <rrwo at cpan.org>
129
130 LICENSE
131 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. This
132 program is free software; you can redistribute it and/or modify it under
133 the same terms as Perl itself.
134
0 # NAME
1
2 Graphics::ColorNames - defines RGB values for common color names
3
4 # VERSION
5
6 version v3.5.0
7
8 # SYNOPSIS
9
10 ```perl
11 use Graphics::ColorNames;
12 use Graphics::ColorNames::WWW;
13
14 $pal = Graphics::ColorNames->new( qw[ X WWW ] );
15
16 $rgb = $pal->hex('green'); # returns '00ff00'
17 $rgb = $pal->hex('green', '0x'); # returns '0x00ff00'
18 $rgb = $pal->hex('green', '#'); # returns '#00ff00'
19
20 $rgb = $pal->rgb('green'); # returns '0,255,0'
21 @rgb = $pal->rgb('green'); # returns (0, 255, 0)
22 ```
23
24 # DESCRIPTION
25
26 This module provides a common interface for obtaining the RGB values
27 of colors by standard names. The intention is to (1) provide a common
28 module that authors can use with other modules to specify colors by
29 name; and (2) free module authors from having to "re-invent the wheel"
30 whenever they decide to give the users the option of specifying a
31 color by name rather than RGB value.
32
33 # METHODS
34
35 ## `new`
36
37 The constructor is as follows:
38
39 ```perl
40 my $pal = Graphics::ColorNames->new( @schemes );
41 ```
42
43 where `@schemes` is an array of color schemes (palettes, dictionaries).
44
45 A valid color scheme may be the name of a color scheme (such as `X`
46 or a full module name such as `Graphics::ColorNames::X`), a reference
47 to a color scheme hash or subroutine, or to the path or open
48 filehandle for a `rgb.txt` file.
49
50 If none are specified, it uses the default `X` color scheme, which
51 corresponds to the X-Windows `rgb.txt` colors. For most purposes,
52 this is good enough. Since v3.2.0, it was updated to use the
53 2014-07-06 colors, so includes the standard CSS colors as well.
54
55 Other color schemes are available on CPAN,
56 e.g. [Graphics::ColorNames::WWW](https://metacpan.org/pod/Graphics::ColorNames::WWW).
57
58 Since version 2.1002, [Color::Library](https://metacpan.org/pod/Color::Library) dictionaries can be used as
59 well:
60
61 ```perl
62 my $pal = Graphics::ColorNames->new( 'Color::Library::Dictionary::HTML' );
63 ```
64
65 ## `rgb`
66
67 ```
68 @rgb = $pal->rgb($name);
69
70 $rgb = $pal->rgb($name, $separator);
71 ```
72
73 If called in a list context, returns a triplet.
74
75 If called in a scalar context, returns a string separated by an
76 optional separator (which defauls to a comma). For example,
77
78 ```
79 @rgb = $pal->rgb('blue'); # returns (0, 0, 255)
80
81 $rgb = $pal->rgb('blue', ','); # returns "0,0,255"
82 ```
83
84 Unknown color names return empty lists or strings, depending on the
85 context.
86
87 Color names are case insensitive, and spaces or punctuation are
88 ignored. So "Alice Blue" returns the same value as "aliceblue",
89 "ALICE-BLUE" and "a\*lICEbl-ue". (If you are using color names based
90 on user input, you should add additional validation of the color
91 names.)
92
93 The value returned is in the six-digit hexidecimal format used in HTML and
94 CSS (without the initial '#'). To convert it to separate red, green, and
95 blue values (between 0 and 255), use the ["hex2tuple"](#hex2tuple) function.
96
97 You may also specify an absolute filename as a color scheme, if the file
98 is in the same format as the standard `rgb.txt` file.
99
100 ## `hex`
101
102 ```
103 $hex = $pal->hex($name, $prefix);
104 ```
105
106 Returns a 6-digit hexidecimal RGB code for the color. If an optional
107 prefix is specified, it will prefix the code with that string. For
108 example,
109
110 ```
111 $hex = $pal->hex('blue', '#'); # returns "#0000ff"
112 ```
113
114 If the color does not exist, it will return an empty string.
115
116 A hexidecimal RGB value in the form of `#RRGGBB`, `0xRRGGBB` or
117 `RRGGBB` will return itself:
118
119 ```
120 $color = $pal->hex('#123abc'); # returns '123abc'
121 ```
122
123 ## autoloaded color name methods
124
125 Autoloaded color name methods were removed in v3.4.0.
126
127 ## `load_scheme`
128
129 ```
130 $pal->load_scheme( $scheme );
131 ```
132
133 This dynamically loads a color scheme, which can be either a hash
134 reference or code reference.
135
136 # EXPORTS
137
138 ## `all_schemes`
139
140 ```perl
141 my @schemes = all_schemes();
142 ```
143
144 Returns a list of all available color schemes installed on the machine
145 in the `Graphics::ColorNames` namespace.
146
147 The order has no significance.
148
149 ## `hex2tuple`
150
151 Converts a hexidecimal string to a tuple.
152
153 ## `tuple2hex`
154
155 Converts a tuple to a hexidecimal string.
156
157 # TIED INTERFACE
158
159 The standard interface (prior to version 0.40) was through a tied hash:
160
161 ```
162 tie %pal, 'Graphics::ColorNames', qw[ X WWW ];
163 ```
164
165 This interface is deprecated, and will be moved to a separate module
166 in the future.
167
168 # CUSTOM COLOR SCHEMES
169
170 You can add naming scheme files by creating a Perl module is the name
171 `Graphics::ColorNames::SCHEMENAME` which has a subroutine named
172 `NamesRgbTable` that returns a hash of color names and RGB values.
173 (Schemes with a different base namespace will require the fill namespace
174 to be given.)
175
176 The color names must be in all lower-case, and the RGB values must be
177 24-bit numbers containing the red, green, and blue values in most- significant
178 to least- significant byte order.
179
180 An example naming schema is below:
181
182 ```perl
183 package Graphics::ColorNames::Metallic;
184
185 sub NamesRgbTable() {
186 use integer;
187 return {
188 copper => 0xb87333,
189 gold => 0xcd7f32,
190 silver => 0xe6e8fa,
191 };
192 }
193 ```
194
195 You would use the above schema as follows:
196
197 ```
198 tie %colors, 'Graphics::ColorNames', 'Metallic';
199 ```
200
201 The behavior of specifying multiple keys with the same name is undefined
202 as to which one takes precedence.
203
204 As of version 2.10, case, spaces and punctuation are ignored in color
205 names. So a name like "Willy's Favorite Shade-of-Blue" is treated the
206 same as "willysfavoroteshadeofblue". (If your scheme does not include
207 duplicate entrieswith spaces and punctuation, then the minimum
208 version of [Graphics::ColorNames](https://metacpan.org/pod/Graphics::ColorNames) should be 2.10 in your requirements.)
209
210 An example of an additional module is the [Graphics::ColorNames::Mozilla](https://metacpan.org/pod/Graphics::ColorNames::Mozilla)
211 module.
212
213 Since version 1.03, `NamesRgbTable` may also return a code reference:
214
215 ```perl
216 package Graphics::ColorNames::Orange;
217
218 sub NamesRgbTable() {
219 return sub {
220 my $name = shift;
221 return 0xffa500;
222 };
223 }
224 ```
225
226 See [Graphics::ColorNames::GrayScale](https://metacpan.org/pod/Graphics::ColorNames::GrayScale) for an example.
227
228 # ROADMAP
229
230 The following changes are planned in the future:
231
232 - The tied interface will be removed, but implemented in a separate
233 module for users that wish to use it.
234 - The namespace for color schemes will be moved to the
235 `Graphics::ColorNames::Schemes` but options will be added to use the
236 existing scheme.
237
238 This will allow modules to be named like `Graphics::ColorNames::Tied`
239 without being confused for color schemes.
240
241 - This module will be rewritten to be a [Moo](https://metacpan.org/pod/Moo)-based class.
242
243 # SEE ALSO
244
245 [Color::Library](https://metacpan.org/pod/Color::Library) provides an extensive library of color schemes. A notable
246 difference is that it supports more complex schemes which contain additional
247 information about individual colors and map multiple colors to a single name.
248
249 [Color::Rgb](https://metacpan.org/pod/Color::Rgb) has a similar function to this module, but parses an
250 `rgb.txt` file.
251
252 [Graphics::ColorObject](https://metacpan.org/pod/Graphics::ColorObject) can convert between RGB and other color space
253 types.
254
255 [Graphics::ColorUtils](https://metacpan.org/pod/Graphics::ColorUtils) can also convert betweeb RGB and other color
256 space types, and supports RGB from names in various color schemes.
257
258 [Acme::AutoColor](https://metacpan.org/pod/Acme::AutoColor) provides subroutines corresponding to color names.
259
260 # SOURCE
261
262 The development version is on github at [https://github.com/robrwo/Graphics-ColorNames](https://github.com/robrwo/Graphics-ColorNames)
263 and may be cloned from [git://github.com/robrwo/Graphics-ColorNames.git](git://github.com/robrwo/Graphics-ColorNames.git)
264
265 The SourceForge project for this module at
266 [http://sourceforge.net/projects/colornames/](http://sourceforge.net/projects/colornames/) is no longer
267 maintained.
268
269 # BUGS
270
271 Please report any bugs or feature requests on the bugtracker website
272 [https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames](https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames) or
273 by email to
274 [bug-Graphics-ColorNames@rt.cpan.org](mailto:bug-Graphics-ColorNames@rt.cpan.org).
275
276 When submitting a bug or request, please include a test-file or a
277 patch to an existing test-file that illustrates the bug or desired
278 feature.
279
280 # AUTHOR
281
282 Robert Rothenberg <rrwo@cpan.org>
283
284 # CONTRIBUTORS
285
286 - Alan D. Salewski <alans@cji.com>
287 - Steve Pomeroy <xavier@cpan.org>
288 - "chemboy" <chemboy@perlmonk.org>
289 - Magnus Cedergren <magnus@mbox604.swipnet.se>
290 - Gary Vollink <gary@vollink.com>
291 - Claus Färber <cfaerber@cpan.org>
292 - Andreas J. König <andk@cpan.org>
293 - Slaven Rezić <slaven@rezic.de>
294
295 # COPYRIGHT AND LICENSE
296
297 This software is Copyright (c) 2001-2019 by Robert Rothenberg.
298
299 This is free software, licensed under:
300
301 ```
302 The Artistic License 2.0 (GPL Compatible)
303 ```
0 requires "Exporter" => "5.57";
1 requires "Module::Load" => "0.10";
2 requires "Module::Loaded" => "0";
3 requires "perl" => "v5.10.0";
4 requires "version" => "0";
5
6 on 'test' => sub {
7 requires "File::Spec" => "0";
8 requires "FileHandle" => "0";
9 requires "IO::File" => "0";
10 requires "Module::Metadata" => "0";
11 requires "Test::Exception" => "0";
12 requires "Test::More" => "0";
13 requires "Test::Most" => "0";
14 requires "constant" => "0";
15 requires "lib" => "0";
16 requires "perl" => "v5.10.0";
17 };
18
19 on 'test' => sub {
20 recommends "CPAN::Meta" => "2.120900";
21 };
22
23 on 'configure' => sub {
24 requires "ExtUtils::MakeMaker" => "0";
25 };
26
27 on 'develop' => sub {
28 requires "Test::EOF" => "0";
29 requires "Test::EOL" => "0";
30 requires "Test::MinimumVersion" => "0";
31 requires "Test::More" => "0.88";
32 requires "Test::NoTabs" => "0";
33 requires "Test::Pod" => "1.41";
34 requires "Test::Pod::LinkCheck" => "0";
35 requires "Test::Portability::Files" => "0";
36 requires "Test::TrailingSpace" => "0.0203";
37 };
0 name = Graphics-ColorNames
1 author = Robert Rothenberg <rrwo@cpan.org>
2 license = Artistic_2_0
3 copyright_holder = Robert Rothenberg
4 copyright_year = 2001-2019
5
6 [Keywords]
7 keyword = color
8
9 [Meta::Contributors]
10 contributor = Alan D. Salewski <alans@cji.com>
11 contributor = Steve Pomeroy <xavier@cpan.org>
12 contributor = "chemboy" <chemboy@perlmonk.org>
13 contributor = Magnus Cedergren <magnus@mbox604.swipnet.se>
14 contributor = Gary Vollink <gary@vollink.com>
15 contributor = Claus Färber <cfaerber@cpan.org>
16 contributor = Andreas J. König <andk@cpan.org>
17 contributor = Slaven Rezić <slaven@rezic.de>
18
19 [GatherDir]
20 exclude_match = cpanfile*
21 exclude_filename = MANIFEST.SKIP
22 [PruneCruft]
23 [CPANFile]
24 [License]
25 [ExtraTests]
26 [ExecDir]
27 [ShareDir]
28 [MakeMaker]
29 [Manifest]
30 [TestRelease]
31 [ConfirmRelease]
32 [UploadToCPAN]
33
34 [RecommendedPrereqs]
35 [AutoPrereqs]
36 [RemovePrereqs]
37 remove = strict
38 remove = warnings
39 remove = integer
40 remove = base
41 remove = Carp
42 remove = File::Spec::Functions
43
44 [EnsurePrereqsInstalled]
45 :version = 0.003
46 type = requires
47 type = recommends
48
49 [GitHub::Meta]
50 repo = git://github.com/robrwo/Graphics-ColorNames.git
51
52 [MetaResources]
53 bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames
54 bugtracker.mailto = bug-Graphics-ColorNames@rt.cpan.org
55
56 [PodWeaver]
57 [ReadmeAnyFromPod]
58 type = gfm
59 filename = README.md
60 location = build
61
62 [CopyFilesFromBuild]
63 copy = README.md
64 copy = cpanfile
65 copy = MANIFEST.SKIP
66
67 [Generate::ManifestSkip]
68 :version = v0.1.5
69 [PruneFiles]
70 match = ~$
71
72 [Metadata]
73 x_authority = cpan:RRWO
74
75 [MetaProvides::Package]
76 [MetaJSON]
77 [MetaYAML]
78
79 [InstallGuide]
80
81 [Prereqs]
82 Exporter = 5.57
83
84 [Prereqs / TestRequires ]
85
86 ; authordep Pod::Weaver::Plugin::AppendPrepend
87 ; authordep Pod::Weaver::Section::Contributors
88 ; authordep Pod::Weaver::Section::SourceGitHub
89
90 [PodSyntaxTests]
91 [Test::CheckManifest]
92 ;;[Test::CleanNamespaces]
93 [Test::EOF]
94 [Test::EOL]
95 :version = 0.14
96 [Test::Fixme]
97 [Test::MinimumVersion]
98 [Test::NoTabs]
99 ;;[Test::Perl::Critic]
100 ;;critic_config = t/etc/perlcritic.rc
101
102 ;;[Test::Pod::Coverage::Configurable]
103 [Test::Pod::LinkCheck]
104 [Test::Portability]
105 ; authordep Test::TrailingSpace
106 [Test::TrailingSpace]
107 filename_regex = \.(?:p[lm]|pod)\z
108 ;; [Test::Kwalitee]
109 [Test::ReportPrereqs]
110 :version = 0.022
111 version_extractor = Module::Metadata
112 verify_prereqs = 1
113
114 [@Git]
115 allow_dirty = dist.ini
116 push_to = origin master:master
117 tag_format = %v
118 commit_msg = %v%n%n%c
119
120 [Git::Contributors]
121 :version = 0.019
122
123 [RewriteVersion]
124 [NextRelease]
125 [BumpVersionAfterRelease]
126
127 [Git::Commit / Commit_Changes] ; commit Changes (for new dev)
128 allow_dirty_match = ^lib/
129 commit_msg = Commit Changes and bump $VERSION
+0
-76
lib/Graphics/ColorNames/HTML.pm less more
0 package Graphics::ColorNames::HTML;
1
2 =head1 NAME
3
4 Graphics::ColorNames::HTML - HTML color names and equivalent RGB values
5
6 =head1 SYNOPSIS
7
8 require Graphics::ColorNames::HTML;
9
10 $NameTable = Graphics::ColorNames::HTML->NamesRgbTable();
11 $RgbBlack = $NameTable->{black};
12
13 =head1 DESCRIPTION
14
15 This module defines color names and their associated RGB values from the
16 HTML 4.0 Specification.
17
18 =head2 Note
19
20 In versions prior to 1.1, "fuchsia" was misspelled "fuscia". This
21 mispelling came from un unidentified HTML specification. It also
22 appears to be a common misspelling, so rather than change it, the
23 proper spelling was added.
24
25 =head1 SEE ALSO
26
27 L<Graphics::ColorNames>, HTML 4.0 Specificiation <http://www.w3.org>
28
29 L<Graphics::ColorNames::SVG>, which uses color names based on the SVG
30 specification (which is more recent).
31
32 =head1 AUTHOR
33
34 Robert Rothenberg <rrwo at cpan.org>
35
36 =head1 LICENSE
37
38 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved.
39 This program is free software; you can redistribute it and/or
40 modify it under the same terms as Perl itself.
41
42 =cut
43
44 use strict;
45 use warnings;
46
47 our $VERSION = '2.11';
48 #$VERSION = eval $VERSION;
49
50 sub NamesRgbTable() {
51 use integer;
52 return {
53 'black' => 0x000000,
54 'blue' => 0x0000ff,
55 'aqua' => 0x00ffff,
56 'lime' => 0x00ff00,
57 'fuchsia' => 0xff00ff, # "fuscia" is incorrect but common
58 'fuscia' => 0xff00ff, # mis-spelling...
59 'red' => 0xff0000,
60 'yellow' => 0xffff00,
61 'white' => 0xffffff,
62 'navy' => 0x000080,
63 'teal' => 0x008080,
64 'green' => 0x008000,
65 'purple' => 0x800080,
66 'maroon' => 0x800000,
67 'olive' => 0x808000,
68 'gray' => 0x808080,
69 'silver' => 0xc0c0c0,
70 };
71 }
72
73 1;
74
75 __END__
+0
-175
lib/Graphics/ColorNames/Netscape.pm less more
0 package Graphics::ColorNames::Netscape;
1
2 =head1 NAME
3
4 Graphics::ColorNames::Netscape - Netscape 1.1 Color Names
5
6 =head1 SYNOPSIS
7
8 require Graphics::ColorNames::Netscape;
9
10 $NameTable = Graphics::ColorNames::Netscape->NamesRgbTable();
11 $RgbBlack = $NameTable->{black};
12
13 =head1 DESCRIPTION
14
15 This module defines color names and their associated RGB values associated
16 with Netscape 1.1 (I cannot determine whether they were once usable in
17 Netscape or were arbitrary names for RGB values-- I<many of these names are
18 not recognized by later versions of Netscape>).
19
20 This scheme is deprecated, and will be removed from future versions of
21 L<Graphics::ColorNames> but available as a separate module from CPAN.
22
23 =head1 SEE ALSO
24
25 L<Graphics::ColorNames>
26
27 L<Graphics::ColorNames::Mozilla>
28
29 L<Graphics::ColorNames::IE>
30
31 L<Graphics::ColorNames::SVG>
32
33 The color names come from L<http://wp.netscape.com/home/bg/colorindex.html>.
34 Corrections to errors in the Netscape spec are due to
35 L<http://www.he.net/info/color/>.
36
37 =head1 AUTHOR
38
39 Robert Rothenberg <rrwo at cpan.org>
40
41 =head2 Acknowledgements
42
43 "Magnus", who pointed out inconsistencies.
44
45 Gary Vollink, who suggested color schemes for later Netscape versions,
46 and pointed out that the original Netscape page had moved.
47
48 =head1 LICENSE
49
50 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved.
51 This program is free software; you can redistribute it and/or
52 modify it under the same terms as Perl itself.
53
54 =cut
55
56 use strict;
57 use warnings;
58
59 our $VERSION = '2.11';
60 #$VERSION = eval $VERSION;
61
62 # See http://home1.netscape.com/home/bg/colorindex.html
63
64 sub NamesRgbTable() {
65 use integer;
66 return {
67 "white" =>0xffffff,
68 "red" =>0xff0000,
69 "green" =>0x00ff00,
70 "blue" =>0x0000ff,
71 "magenta" =>0xff00ff,
72 "cyan" =>0x00ffff,
73 "yellow" =>0xffff00,
74 "black" =>0x000000,
75 "aquamarine" =>0x70db93,
76 "bakerschocolate" =>0x5c3317,
77 "blueviolet" =>0x9f5f9f,
78 "brass" =>0xb5a642,
79 "brightgold" =>0xd9d919,
80 "brown" =>0xa62a2a,
81 "bronze" =>0x8c7853,
82 "bronzeii" =>0xa67d3d,
83 "cadetblue" =>0x5f9f9f,
84 "coolcopper" =>0xd98719,
85 "copper" =>0xb87333,
86 "coral" =>0xff7f00,
87 "cornflowerblue" =>0x42426f,
88 "darkbrown" =>0x5c4033,
89 "darkgreen" =>0x2f4f2f,
90 "darkgreencopper" =>0x4a766e,
91 "darkolivegreen" =>0x4f4f2f,
92 "darkorchid" =>0x9932cd,
93 "darkpurple" =>0x871f78,
94 "darkslateblue" =>0x241882,
95 "darkslategrey" =>0x2f4f4f,
96 "darktan" =>0x97694f,
97 "darkturquoise" =>0x7093db,
98 "darkwood" =>0x855e42,
99 "dimgrey" =>0x545454,
100 "dustyrose" =>0x856363,
101 "feldspar" =>0xd19275,
102 "firebrick" =>0x8e2323,
103 "flesh" =>0xf5ccb0,
104 "forestgreen" =>0x238e23,
105 "gold" =>0xcd7f32, #
106 "goldenrod" =>0xdbdb70,
107 "grey" =>0x545454,
108 "greencopper" =>0x856363,
109 "greenyellow" =>0xd19275,
110 "huntergreen" =>0x8e2323,
111 "indianred" =>0xf5ccb0,
112 "khaki" =>0x238e23,
113 "lightblue" =>0xcdd9d9, #
114 "lightgrey" =>0xdbdb70,
115 "lightsteelblue" =>0x545454,
116 "lightwood" =>0x856363,
117 "limegreen" =>0xd19275,
118 "mandarianorange" =>0x8e2323,
119 "maroon" =>0xf5ccb0,
120 "mediumaquamarine" =>0x238e23,
121 "mediumblue" =>0x3232cd, #
122 "mediumforestgreen" =>0xdbdb70,
123 "mediumgoldenrod" =>0xeaeaae,
124 "mediumorchid" =>0x9370db,
125 "mediumseagreen" =>0x426f42,
126 "mediumslateblue" =>0x7f00ff,
127 "mediumspringgreen" =>0x7fff00,
128 "mediumturquoise" =>0x70dbdb,
129 "mediumvioletred" =>0xdb7093,
130 "mediumwood" =>0xa68064,
131 "midnightblue" =>0x2f2f4f,
132 "navyblue" =>0x23238e,
133 "neonblue" =>0x4d4dff,
134 "neonpink" =>0xff6ec7,
135 "newmidnightblue" =>0x00009c,
136 "newtan" =>0xebc79e,
137 "oldgold" =>0xcfb53b,
138 "orange" =>0xff7f00,
139 "orangered" =>0xff2400,
140 "orchid" =>0xdb70db,
141 "palegreen" =>0x8fbc8f,
142 "pink" =>0xbc8f8f,
143 "plum" =>0xeaadea,
144 "quartz" =>0xd9d9f3,
145 "richblue" =>0x5959ab,
146 "salmon" =>0x6f4242,
147 "scarlet" =>0x8c1717,
148 "seagreen" =>0x238e68,
149 "semisweetchocolate" =>0x6b4226,
150 "sienna" =>0x8e6b23,
151 "silver" =>0xe6e8fa,
152 "skyblue" =>0x3299cc,
153 "slateblue" =>0x007fff,
154 "spicypink" =>0xff1cae,
155 "springgreen" =>0x00ff7f,
156 "steelblue" =>0x236b8e,
157 "summersky" =>0x38b0de,
158 "tan" =>0xdb9370,
159 "thistle" =>0xd8bfd8,
160 "turquoise" =>0xadeaea,
161 "verydarkbrown" =>0x5c4033,
162 "verylightgrey" =>0xcdcdcd,
163 "violet" =>0x4f2f4f,
164 "violetred" =>0xcc3299,
165 "wheat" =>0xd8d8bf,
166 "yellowgreen" =>0x99cc32,
167 };
168 }
169
170
171 1;
172
173 __END__
174
+0
-66
lib/Graphics/ColorNames/Windows.pm less more
0 package Graphics::ColorNames::Windows;
1
2 =head1 NAME
3
4 Graphics::ColorNames::Windows - Windows color names and equivalent RGB values
5
6 =head1 SYNOPSIS
7
8 require Graphics::ColorNames::Windows;
9
10 $NameTable = Graphics::ColorNames::Windows->NamesRgbTable();
11 $RgbBlack = $NameTable->{black};
12
13 =head1 DESCRIPTION
14
15 This module defines color names and their associated RGB values used in
16 Microsoft Windows.
17
18 =head1 SEE ALSO
19
20 C<Graphics::ColorNames>
21
22 =head1 AUTHOR
23
24 Robert Rothenberg <rrwo at cpan.org>
25
26 =head1 LICENSE
27
28 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved.
29 This program is free software; you can redistribute it and/or
30 modify it under the same terms as Perl itself.
31
32
33 =cut
34
35 use strict;
36 use warnings;
37
38 our $VERSION = '2.11';
39 #$VERSION = eval $VERSION;
40
41 sub NamesRgbTable() {
42 use integer;
43 return {
44 'black' => 0x000000,
45 'blue' => 0x0000ff,
46 'cyan' => 0x00ffff,
47 'green' => 0x00ff00,
48 'magenta' => 0xff00ff,
49 'red' => 0xff0000,
50 'yellow' => 0xffff00,
51 'white' => 0xffffff,
52 'darkblue' => 0x000080,
53 'darkcyan' => 0x008080,
54 'darkgreen' => 0x008000,
55 'darkmagenta' => 0x800080,
56 'darkred' => 0x800000,
57 'darkyellow' => 0x808000,
58 'darkgray' => 0x808080,
59 'lightgray' => 0xc0c0c0,
60 };
61 }
62
63 1;
64
65 __END__
00 package Graphics::ColorNames::X;
11
2 # ABSTRACT: X-Windows color names and equivalent RGB values
3
4
5 use strict;
6 use warnings;
7
8 our $VERSION = 'v3.5.0';
9
10
11 sub NamesRgbTable() {
12 use integer;
13 return {
14 "snow" => 0xfffafa,
15 "ghostwhite" => 0xf8f8ff,
16 "whitesmoke" => 0xf5f5f5,
17 "gainsboro" => 0xdcdcdc,
18 "floralwhite" => 0xfffaf0,
19 "oldlace" => 0xfdf5e6,
20 "linen" => 0xfaf0e6,
21 "antiquewhite" => 0xfaebd7,
22 "papayawhip" => 0xffefd5,
23 "blanchedalmond" => 0xffebcd,
24 "bisque" => 0xffe4c4,
25 "peachpuff" => 0xffdab9,
26 "navajowhite" => 0xffdead,
27 "moccasin" => 0xffe4b5,
28 "cornsilk" => 0xfff8dc,
29 "ivory" => 0xfffff0,
30 "lemonchiffon" => 0xfffacd,
31 "seashell" => 0xfff5ee,
32 "honeydew" => 0xf0fff0,
33 "mintcream" => 0xf5fffa,
34 "azure" => 0xf0ffff,
35 "aliceblue" => 0xf0f8ff,
36 "lavender" => 0xe6e6fa,
37 "lavenderblush" => 0xfff0f5,
38 "mistyrose" => 0xffe4e1,
39 "white" => 0xffffff,
40 "black" => 0x000000,
41 "darkslategray" => 0x2f4f4f,
42 "darkslategrey" => 0x2f4f4f,
43 "dimgray" => 0x696969,
44 "dimgrey" => 0x696969,
45 "slategray" => 0x708090,
46 "slategrey" => 0x708090,
47 "lightslategray" => 0x778899,
48 "lightslategrey" => 0x778899,
49 "gray" => 0xbebebe,
50 "grey" => 0xbebebe,
51 "x11gray" => 0xbebebe,
52 "x11grey" => 0xbebebe,
53 "webgray" => 0x808080,
54 "webgrey" => 0x808080,
55 "lightgrey" => 0xd3d3d3,
56 "lightgray" => 0xd3d3d3,
57 "midnightblue" => 0x191970,
58 "navy" => 0x000080,
59 "navyblue" => 0x000080,
60 "cornflowerblue" => 0x6495ed,
61 "darkslateblue" => 0x483d8b,
62 "slateblue" => 0x6a5acd,
63 "mediumslateblue" => 0x7b68ee,
64 "lightslateblue" => 0x8470ff,
65 "mediumblue" => 0x0000cd,
66 "royalblue" => 0x4169e1,
67 "blue" => 0x0000ff,
68 "dodgerblue" => 0x1e90ff,
69 "deepskyblue" => 0x00bfff,
70 "skyblue" => 0x87ceeb,
71 "lightskyblue" => 0x87cefa,
72 "steelblue" => 0x4682b4,
73 "lightsteelblue" => 0xb0c4de,
74 "lightblue" => 0xadd8e6,
75 "powderblue" => 0xb0e0e6,
76 "paleturquoise" => 0xafeeee,
77 "darkturquoise" => 0x00ced1,
78 "mediumturquoise" => 0x48d1cc,
79 "turquoise" => 0x40e0d0,
80 "cyan" => 0x00ffff,
81 "aqua" => 0x00ffff,
82 "lightcyan" => 0xe0ffff,
83 "cadetblue" => 0x5f9ea0,
84 "mediumaquamarine" => 0x66cdaa,
85 "aquamarine" => 0x7fffd4,
86 "darkgreen" => 0x006400,
87 "darkolivegreen" => 0x556b2f,
88 "darkseagreen" => 0x8fbc8f,
89 "seagreen" => 0x2e8b57,
90 "mediumseagreen" => 0x3cb371,
91 "lightseagreen" => 0x20b2aa,
92 "palegreen" => 0x98fb98,
93 "springgreen" => 0x00ff7f,
94 "lawngreen" => 0x7cfc00,
95 "green" => 0x00ff00,
96 "lime" => 0x00ff00,
97 "x11green" => 0x00ff00,
98 "webgreen" => 0x008000,
99 "chartreuse" => 0x7fff00,
100 "mediumspringgreen" => 0x00fa9a,
101 "greenyellow" => 0xadff2f,
102 "limegreen" => 0x32cd32,
103 "yellowgreen" => 0x9acd32,
104 "forestgreen" => 0x228b22,
105 "olivedrab" => 0x6b8e23,
106 "darkkhaki" => 0xbdb76b,
107 "khaki" => 0xf0e68c,
108 "palegoldenrod" => 0xeee8aa,
109 "lightgoldenrodyellow" => 0xfafad2,
110 "lightyellow" => 0xffffe0,
111 "yellow" => 0xffff00,
112 "gold" => 0xffd700,
113 "lightgoldenrod" => 0xeedd82,
114 "goldenrod" => 0xdaa520,
115 "darkgoldenrod" => 0xb8860b,
116 "rosybrown" => 0xbc8f8f,
117 "indianred" => 0xcd5c5c,
118 "saddlebrown" => 0x8b4513,
119 "sienna" => 0xa0522d,
120 "peru" => 0xcd853f,
121 "burlywood" => 0xdeb887,
122 "beige" => 0xf5f5dc,
123 "wheat" => 0xf5deb3,
124 "sandybrown" => 0xf4a460,
125 "tan" => 0xd2b48c,
126 "chocolate" => 0xd2691e,
127 "firebrick" => 0xb22222,
128 "brown" => 0xa52a2a,
129 "darksalmon" => 0xe9967a,
130 "salmon" => 0xfa8072,
131 "lightsalmon" => 0xffa07a,
132 "orange" => 0xffa500,
133 "darkorange" => 0xff8c00,
134 "coral" => 0xff7f50,
135 "lightcoral" => 0xf08080,
136 "tomato" => 0xff6347,
137 "orangered" => 0xff4500,
138 "red" => 0xff0000,
139 "hotpink" => 0xff69b4,
140 "deeppink" => 0xff1493,
141 "pink" => 0xffc0cb,
142 "lightpink" => 0xffb6c1,
143 "palevioletred" => 0xdb7093,
144 "maroon" => 0xb03060,
145 "x11maroon" => 0xb03060,
146 "webmaroon" => 0x800000,
147 "mediumvioletred" => 0xc71585,
148 "violetred" => 0xd02090,
149 "magenta" => 0xff00ff,
150 "fuchsia" => 0xff00ff,
151 "violet" => 0xee82ee,
152 "plum" => 0xdda0dd,
153 "orchid" => 0xda70d6,
154 "mediumorchid" => 0xba55d3,
155 "darkorchid" => 0x9932cc,
156 "darkviolet" => 0x9400d3,
157 "blueviolet" => 0x8a2be2,
158 "purple" => 0xa020f0,
159 "x11purple" => 0xa020f0,
160 "webpurple" => 0x800080,
161 "mediumpurple" => 0x9370db,
162 "thistle" => 0xd8bfd8,
163 "snow1" => 0xfffafa,
164 "snow2" => 0xeee9e9,
165 "snow3" => 0xcdc9c9,
166 "snow4" => 0x8b8989,
167 "seashell1" => 0xfff5ee,
168 "seashell2" => 0xeee5de,
169 "seashell3" => 0xcdc5bf,
170 "seashell4" => 0x8b8682,
171 "antiquewhite1" => 0xffefdb,
172 "antiquewhite2" => 0xeedfcc,
173 "antiquewhite3" => 0xcdc0b0,
174 "antiquewhite4" => 0x8b8378,
175 "bisque1" => 0xffe4c4,
176 "bisque2" => 0xeed5b7,
177 "bisque3" => 0xcdb79e,
178 "bisque4" => 0x8b7d6b,
179 "peachpuff1" => 0xffdab9,
180 "peachpuff2" => 0xeecbad,
181 "peachpuff3" => 0xcdaf95,
182 "peachpuff4" => 0x8b7765,
183 "navajowhite1" => 0xffdead,
184 "navajowhite2" => 0xeecfa1,
185 "navajowhite3" => 0xcdb38b,
186 "navajowhite4" => 0x8b795e,
187 "lemonchiffon1" => 0xfffacd,
188 "lemonchiffon2" => 0xeee9bf,
189 "lemonchiffon3" => 0xcdc9a5,
190 "lemonchiffon4" => 0x8b8970,
191 "cornsilk1" => 0xfff8dc,
192 "cornsilk2" => 0xeee8cd,
193 "cornsilk3" => 0xcdc8b1,
194 "cornsilk4" => 0x8b8878,
195 "ivory1" => 0xfffff0,
196 "ivory2" => 0xeeeee0,
197 "ivory3" => 0xcdcdc1,
198 "ivory4" => 0x8b8b83,
199 "honeydew1" => 0xf0fff0,
200 "honeydew2" => 0xe0eee0,
201 "honeydew3" => 0xc1cdc1,
202 "honeydew4" => 0x838b83,
203 "lavenderblush1" => 0xfff0f5,
204 "lavenderblush2" => 0xeee0e5,
205 "lavenderblush3" => 0xcdc1c5,
206 "lavenderblush4" => 0x8b8386,
207 "mistyrose1" => 0xffe4e1,
208 "mistyrose2" => 0xeed5d2,
209 "mistyrose3" => 0xcdb7b5,
210 "mistyrose4" => 0x8b7d7b,
211 "azure1" => 0xf0ffff,
212 "azure2" => 0xe0eeee,
213 "azure3" => 0xc1cdcd,
214 "azure4" => 0x838b8b,
215 "slateblue1" => 0x836fff,
216 "slateblue2" => 0x7a67ee,
217 "slateblue3" => 0x6959cd,
218 "slateblue4" => 0x473c8b,
219 "royalblue1" => 0x4876ff,
220 "royalblue2" => 0x436eee,
221 "royalblue3" => 0x3a5fcd,
222 "royalblue4" => 0x27408b,
223 "blue1" => 0x0000ff,
224 "blue2" => 0x0000ee,
225 "blue3" => 0x0000cd,
226 "blue4" => 0x00008b,
227 "dodgerblue1" => 0x1e90ff,
228 "dodgerblue2" => 0x1c86ee,
229 "dodgerblue3" => 0x1874cd,
230 "dodgerblue4" => 0x104e8b,
231 "steelblue1" => 0x63b8ff,
232 "steelblue2" => 0x5cacee,
233 "steelblue3" => 0x4f94cd,
234 "steelblue4" => 0x36648b,
235 "deepskyblue1" => 0x00bfff,
236 "deepskyblue2" => 0x00b2ee,
237 "deepskyblue3" => 0x009acd,
238 "deepskyblue4" => 0x00688b,
239 "skyblue1" => 0x87ceff,
240 "skyblue2" => 0x7ec0ee,
241 "skyblue3" => 0x6ca6cd,
242 "skyblue4" => 0x4a708b,
243 "lightskyblue1" => 0xb0e2ff,
244 "lightskyblue2" => 0xa4d3ee,
245 "lightskyblue3" => 0x8db6cd,
246 "lightskyblue4" => 0x607b8b,
247 "slategray1" => 0xc6e2ff,
248 "slategray2" => 0xb9d3ee,
249 "slategray3" => 0x9fb6cd,
250 "slategray4" => 0x6c7b8b,
251 "lightsteelblue1" => 0xcae1ff,
252 "lightsteelblue2" => 0xbcd2ee,
253 "lightsteelblue3" => 0xa2b5cd,
254 "lightsteelblue4" => 0x6e7b8b,
255 "lightblue1" => 0xbfefff,
256 "lightblue2" => 0xb2dfee,
257 "lightblue3" => 0x9ac0cd,
258 "lightblue4" => 0x68838b,
259 "lightcyan1" => 0xe0ffff,
260 "lightcyan2" => 0xd1eeee,
261 "lightcyan3" => 0xb4cdcd,
262 "lightcyan4" => 0x7a8b8b,
263 "paleturquoise1" => 0xbbffff,
264 "paleturquoise2" => 0xaeeeee,
265 "paleturquoise3" => 0x96cdcd,
266 "paleturquoise4" => 0x668b8b,
267 "cadetblue1" => 0x98f5ff,
268 "cadetblue2" => 0x8ee5ee,
269 "cadetblue3" => 0x7ac5cd,
270 "cadetblue4" => 0x53868b,
271 "turquoise1" => 0x00f5ff,
272 "turquoise2" => 0x00e5ee,
273 "turquoise3" => 0x00c5cd,
274 "turquoise4" => 0x00868b,
275 "cyan1" => 0x00ffff,
276 "cyan2" => 0x00eeee,
277 "cyan3" => 0x00cdcd,
278 "cyan4" => 0x008b8b,
279 "darkslategray1" => 0x97ffff,
280 "darkslategray2" => 0x8deeee,
281 "darkslategray3" => 0x79cdcd,
282 "darkslategray4" => 0x528b8b,
283 "aquamarine1" => 0x7fffd4,
284 "aquamarine2" => 0x76eec6,
285 "aquamarine3" => 0x66cdaa,
286 "aquamarine4" => 0x458b74,
287 "darkseagreen1" => 0xc1ffc1,
288 "darkseagreen2" => 0xb4eeb4,
289 "darkseagreen3" => 0x9bcd9b,
290 "darkseagreen4" => 0x698b69,
291 "seagreen1" => 0x54ff9f,
292 "seagreen2" => 0x4eee94,
293 "seagreen3" => 0x43cd80,
294 "seagreen4" => 0x2e8b57,
295 "palegreen1" => 0x9aff9a,
296 "palegreen2" => 0x90ee90,
297 "palegreen3" => 0x7ccd7c,
298 "palegreen4" => 0x548b54,
299 "springgreen1" => 0x00ff7f,
300 "springgreen2" => 0x00ee76,
301 "springgreen3" => 0x00cd66,
302 "springgreen4" => 0x008b45,
303 "green1" => 0x00ff00,
304 "green2" => 0x00ee00,
305 "green3" => 0x00cd00,
306 "green4" => 0x008b00,
307 "chartreuse1" => 0x7fff00,
308 "chartreuse2" => 0x76ee00,
309 "chartreuse3" => 0x66cd00,
310 "chartreuse4" => 0x458b00,
311 "olivedrab1" => 0xc0ff3e,
312 "olivedrab2" => 0xb3ee3a,
313 "olivedrab3" => 0x9acd32,
314 "olivedrab4" => 0x698b22,
315 "darkolivegreen1" => 0xcaff70,
316 "darkolivegreen2" => 0xbcee68,
317 "darkolivegreen3" => 0xa2cd5a,
318 "darkolivegreen4" => 0x6e8b3d,
319 "khaki1" => 0xfff68f,
320 "khaki2" => 0xeee685,
321 "khaki3" => 0xcdc673,
322 "khaki4" => 0x8b864e,
323 "lightgoldenrod1" => 0xffec8b,
324 "lightgoldenrod2" => 0xeedc82,
325 "lightgoldenrod3" => 0xcdbe70,
326 "lightgoldenrod4" => 0x8b814c,
327 "lightyellow1" => 0xffffe0,
328 "lightyellow2" => 0xeeeed1,
329 "lightyellow3" => 0xcdcdb4,
330 "lightyellow4" => 0x8b8b7a,
331 "yellow1" => 0xffff00,
332 "yellow2" => 0xeeee00,
333 "yellow3" => 0xcdcd00,
334 "yellow4" => 0x8b8b00,
335 "gold1" => 0xffd700,
336 "gold2" => 0xeec900,
337 "gold3" => 0xcdad00,
338 "gold4" => 0x8b7500,
339 "goldenrod1" => 0xffc125,
340 "goldenrod2" => 0xeeb422,
341 "goldenrod3" => 0xcd9b1d,
342 "goldenrod4" => 0x8b6914,
343 "darkgoldenrod1" => 0xffb90f,
344 "darkgoldenrod2" => 0xeead0e,
345 "darkgoldenrod3" => 0xcd950c,
346 "darkgoldenrod4" => 0x8b6508,
347 "rosybrown1" => 0xffc1c1,
348 "rosybrown2" => 0xeeb4b4,
349 "rosybrown3" => 0xcd9b9b,
350 "rosybrown4" => 0x8b6969,
351 "indianred1" => 0xff6a6a,
352 "indianred2" => 0xee6363,
353 "indianred3" => 0xcd5555,
354 "indianred4" => 0x8b3a3a,
355 "sienna1" => 0xff8247,
356 "sienna2" => 0xee7942,
357 "sienna3" => 0xcd6839,
358 "sienna4" => 0x8b4726,
359 "burlywood1" => 0xffd39b,
360 "burlywood2" => 0xeec591,
361 "burlywood3" => 0xcdaa7d,
362 "burlywood4" => 0x8b7355,
363 "wheat1" => 0xffe7ba,
364 "wheat2" => 0xeed8ae,
365 "wheat3" => 0xcdba96,
366 "wheat4" => 0x8b7e66,
367 "tan1" => 0xffa54f,
368 "tan2" => 0xee9a49,
369 "tan3" => 0xcd853f,
370 "tan4" => 0x8b5a2b,
371 "chocolate1" => 0xff7f24,
372 "chocolate2" => 0xee7621,
373 "chocolate3" => 0xcd661d,
374 "chocolate4" => 0x8b4513,
375 "firebrick1" => 0xff3030,
376 "firebrick2" => 0xee2c2c,
377 "firebrick3" => 0xcd2626,
378 "firebrick4" => 0x8b1a1a,
379 "brown1" => 0xff4040,
380 "brown2" => 0xee3b3b,
381 "brown3" => 0xcd3333,
382 "brown4" => 0x8b2323,
383 "salmon1" => 0xff8c69,
384 "salmon2" => 0xee8262,
385 "salmon3" => 0xcd7054,
386 "salmon4" => 0x8b4c39,
387 "lightsalmon1" => 0xffa07a,
388 "lightsalmon2" => 0xee9572,
389 "lightsalmon3" => 0xcd8162,
390 "lightsalmon4" => 0x8b5742,
391 "orange1" => 0xffa500,
392 "orange2" => 0xee9a00,
393 "orange3" => 0xcd8500,
394 "orange4" => 0x8b5a00,
395 "darkorange1" => 0xff7f00,
396 "darkorange2" => 0xee7600,
397 "darkorange3" => 0xcd6600,
398 "darkorange4" => 0x8b4500,
399 "coral1" => 0xff7256,
400 "coral2" => 0xee6a50,
401 "coral3" => 0xcd5b45,
402 "coral4" => 0x8b3e2f,
403 "tomato1" => 0xff6347,
404 "tomato2" => 0xee5c42,
405 "tomato3" => 0xcd4f39,
406 "tomato4" => 0x8b3626,
407 "orangered1" => 0xff4500,
408 "orangered2" => 0xee4000,
409 "orangered3" => 0xcd3700,
410 "orangered4" => 0x8b2500,
411 "red1" => 0xff0000,
412 "red2" => 0xee0000,
413 "red3" => 0xcd0000,
414 "red4" => 0x8b0000,
415 "deeppink1" => 0xff1493,
416 "deeppink2" => 0xee1289,
417 "deeppink3" => 0xcd1076,
418 "deeppink4" => 0x8b0a50,
419 "hotpink1" => 0xff6eb4,
420 "hotpink2" => 0xee6aa7,
421 "hotpink3" => 0xcd6090,
422 "hotpink4" => 0x8b3a62,
423 "pink1" => 0xffb5c5,
424 "pink2" => 0xeea9b8,
425 "pink3" => 0xcd919e,
426 "pink4" => 0x8b636c,
427 "lightpink1" => 0xffaeb9,
428 "lightpink2" => 0xeea2ad,
429 "lightpink3" => 0xcd8c95,
430 "lightpink4" => 0x8b5f65,
431 "palevioletred1" => 0xff82ab,
432 "palevioletred2" => 0xee799f,
433 "palevioletred3" => 0xcd6889,
434 "palevioletred4" => 0x8b475d,
435 "maroon1" => 0xff34b3,
436 "maroon2" => 0xee30a7,
437 "maroon3" => 0xcd2990,
438 "maroon4" => 0x8b1c62,
439 "violetred1" => 0xff3e96,
440 "violetred2" => 0xee3a8c,
441 "violetred3" => 0xcd3278,
442 "violetred4" => 0x8b2252,
443 "magenta1" => 0xff00ff,
444 "magenta2" => 0xee00ee,
445 "magenta3" => 0xcd00cd,
446 "magenta4" => 0x8b008b,
447 "orchid1" => 0xff83fa,
448 "orchid2" => 0xee7ae9,
449 "orchid3" => 0xcd69c9,
450 "orchid4" => 0x8b4789,
451 "plum1" => 0xffbbff,
452 "plum2" => 0xeeaeee,
453 "plum3" => 0xcd96cd,
454 "plum4" => 0x8b668b,
455 "mediumorchid1" => 0xe066ff,
456 "mediumorchid2" => 0xd15fee,
457 "mediumorchid3" => 0xb452cd,
458 "mediumorchid4" => 0x7a378b,
459 "darkorchid1" => 0xbf3eff,
460 "darkorchid2" => 0xb23aee,
461 "darkorchid3" => 0x9a32cd,
462 "darkorchid4" => 0x68228b,
463 "purple1" => 0x9b30ff,
464 "purple2" => 0x912cee,
465 "purple3" => 0x7d26cd,
466 "purple4" => 0x551a8b,
467 "mediumpurple1" => 0xab82ff,
468 "mediumpurple2" => 0x9f79ee,
469 "mediumpurple3" => 0x8968cd,
470 "mediumpurple4" => 0x5d478b,
471 "thistle1" => 0xffe1ff,
472 "thistle2" => 0xeed2ee,
473 "thistle3" => 0xcdb5cd,
474 "thistle4" => 0x8b7b8b,
475 "gray0" => 0x000000,
476 "grey0" => 0x000000,
477 "gray1" => 0x030303,
478 "grey1" => 0x030303,
479 "gray2" => 0x050505,
480 "grey2" => 0x050505,
481 "gray3" => 0x080808,
482 "grey3" => 0x080808,
483 "gray4" => 0x0a0a0a,
484 "grey4" => 0x0a0a0a,
485 "gray5" => 0x0d0d0d,
486 "grey5" => 0x0d0d0d,
487 "gray6" => 0x0f0f0f,
488 "grey6" => 0x0f0f0f,
489 "gray7" => 0x121212,
490 "grey7" => 0x121212,
491 "gray8" => 0x141414,
492 "grey8" => 0x141414,
493 "gray9" => 0x171717,
494 "grey9" => 0x171717,
495 "gray10" => 0x1a1a1a,
496 "grey10" => 0x1a1a1a,
497 "gray11" => 0x1c1c1c,
498 "grey11" => 0x1c1c1c,
499 "gray12" => 0x1f1f1f,
500 "grey12" => 0x1f1f1f,
501 "gray13" => 0x212121,
502 "grey13" => 0x212121,
503 "gray14" => 0x242424,
504 "grey14" => 0x242424,
505 "gray15" => 0x262626,
506 "grey15" => 0x262626,
507 "gray16" => 0x292929,
508 "grey16" => 0x292929,
509 "gray17" => 0x2b2b2b,
510 "grey17" => 0x2b2b2b,
511 "gray18" => 0x2e2e2e,
512 "grey18" => 0x2e2e2e,
513 "gray19" => 0x303030,
514 "grey19" => 0x303030,
515 "gray20" => 0x333333,
516 "grey20" => 0x333333,
517 "gray21" => 0x363636,
518 "grey21" => 0x363636,
519 "gray22" => 0x383838,
520 "grey22" => 0x383838,
521 "gray23" => 0x3b3b3b,
522 "grey23" => 0x3b3b3b,
523 "gray24" => 0x3d3d3d,
524 "grey24" => 0x3d3d3d,
525 "gray25" => 0x404040,
526 "grey25" => 0x404040,
527 "gray26" => 0x424242,
528 "grey26" => 0x424242,
529 "gray27" => 0x454545,
530 "grey27" => 0x454545,
531 "gray28" => 0x474747,
532 "grey28" => 0x474747,
533 "gray29" => 0x4a4a4a,
534 "grey29" => 0x4a4a4a,
535 "gray30" => 0x4d4d4d,
536 "grey30" => 0x4d4d4d,
537 "gray31" => 0x4f4f4f,
538 "grey31" => 0x4f4f4f,
539 "gray32" => 0x525252,
540 "grey32" => 0x525252,
541 "gray33" => 0x545454,
542 "grey33" => 0x545454,
543 "gray34" => 0x575757,
544 "grey34" => 0x575757,
545 "gray35" => 0x595959,
546 "grey35" => 0x595959,
547 "gray36" => 0x5c5c5c,
548 "grey36" => 0x5c5c5c,
549 "gray37" => 0x5e5e5e,
550 "grey37" => 0x5e5e5e,
551 "gray38" => 0x616161,
552 "grey38" => 0x616161,
553 "gray39" => 0x636363,
554 "grey39" => 0x636363,
555 "gray40" => 0x666666,
556 "grey40" => 0x666666,
557 "gray41" => 0x696969,
558 "grey41" => 0x696969,
559 "gray42" => 0x6b6b6b,
560 "grey42" => 0x6b6b6b,
561 "gray43" => 0x6e6e6e,
562 "grey43" => 0x6e6e6e,
563 "gray44" => 0x707070,
564 "grey44" => 0x707070,
565 "gray45" => 0x737373,
566 "grey45" => 0x737373,
567 "gray46" => 0x757575,
568 "grey46" => 0x757575,
569 "gray47" => 0x787878,
570 "grey47" => 0x787878,
571 "gray48" => 0x7a7a7a,
572 "grey48" => 0x7a7a7a,
573 "gray49" => 0x7d7d7d,
574 "grey49" => 0x7d7d7d,
575 "gray50" => 0x7f7f7f,
576 "grey50" => 0x7f7f7f,
577 "gray51" => 0x828282,
578 "grey51" => 0x828282,
579 "gray52" => 0x858585,
580 "grey52" => 0x858585,
581 "gray53" => 0x878787,
582 "grey53" => 0x878787,
583 "gray54" => 0x8a8a8a,
584 "grey54" => 0x8a8a8a,
585 "gray55" => 0x8c8c8c,
586 "grey55" => 0x8c8c8c,
587 "gray56" => 0x8f8f8f,
588 "grey56" => 0x8f8f8f,
589 "gray57" => 0x919191,
590 "grey57" => 0x919191,
591 "gray58" => 0x949494,
592 "grey58" => 0x949494,
593 "gray59" => 0x969696,
594 "grey59" => 0x969696,
595 "gray60" => 0x999999,
596 "grey60" => 0x999999,
597 "gray61" => 0x9c9c9c,
598 "grey61" => 0x9c9c9c,
599 "gray62" => 0x9e9e9e,
600 "grey62" => 0x9e9e9e,
601 "gray63" => 0xa1a1a1,
602 "grey63" => 0xa1a1a1,
603 "gray64" => 0xa3a3a3,
604 "grey64" => 0xa3a3a3,
605 "gray65" => 0xa6a6a6,
606 "grey65" => 0xa6a6a6,
607 "gray66" => 0xa8a8a8,
608 "grey66" => 0xa8a8a8,
609 "gray67" => 0xababab,
610 "grey67" => 0xababab,
611 "gray68" => 0xadadad,
612 "grey68" => 0xadadad,
613 "gray69" => 0xb0b0b0,
614 "grey69" => 0xb0b0b0,
615 "gray70" => 0xb3b3b3,
616 "grey70" => 0xb3b3b3,
617 "gray71" => 0xb5b5b5,
618 "grey71" => 0xb5b5b5,
619 "gray72" => 0xb8b8b8,
620 "grey72" => 0xb8b8b8,
621 "gray73" => 0xbababa,
622 "grey73" => 0xbababa,
623 "gray74" => 0xbdbdbd,
624 "grey74" => 0xbdbdbd,
625 "gray75" => 0xbfbfbf,
626 "grey75" => 0xbfbfbf,
627 "gray76" => 0xc2c2c2,
628 "grey76" => 0xc2c2c2,
629 "gray77" => 0xc4c4c4,
630 "grey77" => 0xc4c4c4,
631 "gray78" => 0xc7c7c7,
632 "grey78" => 0xc7c7c7,
633 "gray79" => 0xc9c9c9,
634 "grey79" => 0xc9c9c9,
635 "gray80" => 0xcccccc,
636 "grey80" => 0xcccccc,
637 "gray81" => 0xcfcfcf,
638 "grey81" => 0xcfcfcf,
639 "gray82" => 0xd1d1d1,
640 "grey82" => 0xd1d1d1,
641 "gray83" => 0xd4d4d4,
642 "grey83" => 0xd4d4d4,
643 "gray84" => 0xd6d6d6,
644 "grey84" => 0xd6d6d6,
645 "gray85" => 0xd9d9d9,
646 "grey85" => 0xd9d9d9,
647 "gray86" => 0xdbdbdb,
648 "grey86" => 0xdbdbdb,
649 "gray87" => 0xdedede,
650 "grey87" => 0xdedede,
651 "gray88" => 0xe0e0e0,
652 "grey88" => 0xe0e0e0,
653 "gray89" => 0xe3e3e3,
654 "grey89" => 0xe3e3e3,
655 "gray90" => 0xe5e5e5,
656 "grey90" => 0xe5e5e5,
657 "gray91" => 0xe8e8e8,
658 "grey91" => 0xe8e8e8,
659 "gray92" => 0xebebeb,
660 "grey92" => 0xebebeb,
661 "gray93" => 0xededed,
662 "grey93" => 0xededed,
663 "gray94" => 0xf0f0f0,
664 "grey94" => 0xf0f0f0,
665 "gray95" => 0xf2f2f2,
666 "grey95" => 0xf2f2f2,
667 "gray96" => 0xf5f5f5,
668 "grey96" => 0xf5f5f5,
669 "gray97" => 0xf7f7f7,
670 "grey97" => 0xf7f7f7,
671 "gray98" => 0xfafafa,
672 "grey98" => 0xfafafa,
673 "gray99" => 0xfcfcfc,
674 "grey99" => 0xfcfcfc,
675 "gray100" => 0xffffff,
676 "grey100" => 0xffffff,
677 "darkgrey" => 0xa9a9a9,
678 "darkgray" => 0xa9a9a9,
679 "darkblue" => 0x00008b,
680 "darkcyan" => 0x008b8b,
681 "darkmagenta" => 0x8b008b,
682 "darkred" => 0x8b0000,
683 "lightgreen" => 0x90ee90,
684 "crimson" => 0xdc143c,
685 "indigo" => 0x4b0082,
686 "olive" => 0x808000,
687 "rebeccapurple" => 0x663399,
688 "silver" => 0xc0c0c0,
689 "teal" => 0x008080,
690 };
691 }
692
693 1;
694
695 __END__
696
697 =pod
698
699 =encoding UTF-8
700
2701 =head1 NAME
3702
4703 Graphics::ColorNames::X - X-Windows color names and equivalent RGB values
704
705 =head1 VERSION
706
707 version v3.5.0
5708
6709 =head1 SYNOPSIS
7710
13716 =head1 DESCRIPTION
14717
15718 This module defines color names and their associated RGB values used in
16 X-Windows (from the X-Windows C<rgb.txt> file).
719 X-Windows.
720
721 It is based on the 2014 version of the F<rgb.txt> file, which includes
722 colors from CSS4.
17723
18724 =head1 SEE ALSO
19725
20 L<Graphics::ColorNames>, rgb.txt
726 L<Graphics::ColorNames>
727
728 L<Graphics::ColorNames::CSS>
729
730 L<rgb.txt|https://cgit.freedesktop.org/xorg/app/rgb/plain/rgb.txt>
731
732 =head1 SOURCE
733
734 The development version is on github at L<https://github.com/robrwo/Graphics-ColorNames>
735 and may be cloned from L<git://github.com/robrwo/Graphics-ColorNames.git>
736
737 =head1 BUGS
738
739 Please report any bugs or feature requests on the bugtracker website
740 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames> or
741 by email to
742 L<bug-Graphics-ColorNames@rt.cpan.org|mailto:bug-Graphics-ColorNames@rt.cpan.org>.
743
744 When submitting a bug or request, please include a test-file or a
745 patch to an existing test-file that illustrates the bug or desired
746 feature.
21747
22748 =head1 AUTHOR
23749
24 Robert Rothenberg <rrwo at cpan.org>
25
26 =head2 Acknowledgements
27
28 Steve Pomeroy <steve_x at earthling.net> -- fixed the broken color definitions
29
30 =head1 LICENSE
31
32 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved.
33 This program is free software; you can redistribute it and/or
34 modify it under the same terms as Perl itself.
750 Robert Rothenberg <rrwo@cpan.org>
751
752 =head1 COPYRIGHT AND LICENSE
753
754 This software is Copyright (c) 2001-2019 by Robert Rothenberg.
755
756 This is free software, licensed under:
757
758 The Artistic License 2.0 (GPL Compatible)
35759
36760 =cut
37
38 use strict;
39 use warnings;
40
41 our $VERSION = '2.11';
42 #$VERSION = eval $VERSION;
43
44 # Original name and colors (v1.01 and earlier) from Kevin J. Walsh,
45 # http://eies.njit.edu/~walsh/rgb.html
46
47 # Afterwards, XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp
48 # Verified with Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp
49
50 # Duplicate namesiwth spaces were removed in v2.10.
51
52 sub NamesRgbTable() {
53 use integer;
54 return {
55 "snow" => 0xfffafa,
56 "ghostwhite" => 0xf8f8ff,
57 "whitesmoke" => 0xf5f5f5,
58 "gainsboro" => 0xdcdcdc,
59 "floralwhite" => 0xfffaf0,
60 "oldlace" => 0xfdf5e6,
61 "linen" => 0xfaf0e6,
62 "antiquewhite" => 0xfaebd7,
63 "papayawhip" => 0xffefd5,
64 "blanchedalmond" => 0xffebcd,
65 "bisque" => 0xffe4c4,
66 "peachpuff" => 0xffdab9,
67 "navajowhite" => 0xffdead,
68 "moccasin" => 0xffe4b5,
69 "cornsilk" => 0xfff8dc,
70 "ivory" => 0xfffff0,
71 "lemonchiffon" => 0xfffacd,
72 "seashell" => 0xfff5ee,
73 "honeydew" => 0xf0fff0,
74 "mintcream" => 0xf5fffa,
75 "azure" => 0xf0ffff,
76 "aliceblue" => 0xf0f8ff,
77 "lavender" => 0xe6e6fa,
78 "lavenderblush" => 0xfff0f5,
79 "mistyrose" => 0xffe4e1,
80 "white" => 0xffffff,
81 "black" => 0x000000,
82 "darkslategray" => 0x2f4f4f,
83 "darkslategrey" => 0x2f4f4f,
84 "dimgray" => 0x696969,
85 "dimgrey" => 0x696969,
86 "slategray" => 0x708090,
87 "slategrey" => 0x708090,
88 "lightslategray" => 0x778899,
89 "lightslategrey" => 0x778899,
90 "gray" => 0xbebebe,
91 "grey" => 0xbebebe,
92 "lightgrey" => 0xd3d3d3,
93 "lightgray" => 0xd3d3d3,
94 "midnightblue" => 0x191970,
95 "navy" => 0x000080,
96 "navyblue" => 0x000080,
97 "cornflowerblue" => 0x6495ed,
98 "darkslateblue" => 0x483d8b,
99 "slateblue" => 0x6a5acd,
100 "mediumslateblue" => 0x7b68ee,
101 "lightslateblue" => 0x8470ff,
102 "mediumblue" => 0x0000cd,
103 "royalblue" => 0x4169e1,
104 "blue" => 0x0000ff,
105 "dodgerblue" => 0x1e90ff,
106 "deepskyblue" => 0x00bfff,
107 "skyblue" => 0x87ceeb,
108 "lightskyblue" => 0x87cefa,
109 "steelblue" => 0x4682b4,
110 "lightsteelblue" => 0xb0c4de,
111 "lightblue" => 0xadd8e6,
112 "powderblue" => 0xb0e0e6,
113 "paleturquoise" => 0xafeeee,
114 "darkturquoise" => 0x00ced1,
115 "mediumturquoise" => 0x48d1cc,
116 "turquoise" => 0x40e0d0,
117 "cyan" => 0x00ffff,
118 "lightcyan" => 0xe0ffff,
119 "cadetblue" => 0x5f9ea0,
120 "mediumaquamarine" => 0x66cdaa,
121 "aquamarine" => 0x7fffd4,
122 "darkgreen" => 0x006400,
123 "darkolivegreen" => 0x556b2f,
124 "darkseagreen" => 0x8fbc8f,
125 "seagreen" => 0x2e8b57,
126 "mediumseagreen" => 0x3cb371,
127 "lightseagreen" => 0x20b2aa,
128 "palegreen" => 0x98fb98,
129 "springgreen" => 0x00ff7f,
130 "lawngreen" => 0x7cfc00,
131 "green" => 0x00ff00,
132 "chartreuse" => 0x7fff00,
133 "mediumspringgreen" => 0x00fa9a,
134 "greenyellow" => 0xadff2f,
135 "limegreen" => 0x32cd32,
136 "yellowgreen" => 0x9acd32,
137 "forestgreen" => 0x228b22,
138 "olivedrab" => 0x6b8e23,
139 "darkkhaki" => 0xbdb76b,
140 "khaki" => 0xf0e68c,
141 "palegoldenrod" => 0xeee8aa,
142 "lightgoldenrodyellow" => 0xfafad2,
143 "lightyellow" => 0xffffe0,
144 "yellow" => 0xffff00,
145 "gold" => 0xffd700,
146 "lightgoldenrod" => 0xeedd82,
147 "goldenrod" => 0xdaa520,
148 "darkgoldenrod" => 0xb8860b,
149 "rosybrown" => 0xbc8f8f,
150 "indianred" => 0xcd5c5c,
151 "saddlebrown" => 0x8b4513,
152 "sienna" => 0xa0522d,
153 "peru" => 0xcd853f,
154 "burlywood" => 0xdeb887,
155 "beige" => 0xf5f5dc,
156 "wheat" => 0xf5deb3,
157 "sandybrown" => 0xf4a460,
158 "tan" => 0xd2b48c,
159 "chocolate" => 0xd2691e,
160 "firebrick" => 0xb22222,
161 "brown" => 0xa52a2a,
162 "darksalmon" => 0xe9967a,
163 "salmon" => 0xfa8072,
164 "lightsalmon" => 0xffa07a,
165 "orange" => 0xffa500,
166 "darkorange" => 0xff8c00,
167 "coral" => 0xff7f50,
168 "lightcoral" => 0xf08080,
169 "tomato" => 0xff6347,
170 "orangered" => 0xff4500,
171 "red" => 0xff0000,
172 "hotpink" => 0xff69b4,
173 "deeppink" => 0xff1493,
174 "pink" => 0xffc0cb,
175 "lightpink" => 0xffb6c1,
176 "palevioletred" => 0xdb7093,
177 "maroon" => 0xb03060,
178 "mediumvioletred" => 0xc71585,
179 "violetred" => 0xd02090,
180 "magenta" => 0xff00ff,
181 "violet" => 0xee82ee,
182 "plum" => 0xdda0dd,
183 "orchid" => 0xda70d6,
184 "mediumorchid" => 0xba55d3,
185 "darkorchid" => 0x9932cc,
186 "darkviolet" => 0x9400d3,
187 "blueviolet" => 0x8a2be2,
188 "purple" => 0xa020f0,
189 "mediumpurple" => 0x9370db,
190 "thistle" => 0xd8bfd8,
191 "snow1" => 0xfffafa,
192 "snow2" => 0xeee9e9,
193 "snow3" => 0xcdc9c9,
194 "snow4" => 0x8b8989,
195 "seashell1" => 0xfff5ee,
196 "seashell2" => 0xeee5de,
197 "seashell3" => 0xcdc5bf,
198 "seashell4" => 0x8b8682,
199 "antiquewhite1" => 0xffefdb,
200 "antiquewhite2" => 0xeedfcc,
201 "antiquewhite3" => 0xcdc0b0,
202 "antiquewhite4" => 0x8b8378,
203 "bisque1" => 0xffe4c4,
204 "bisque2" => 0xeed5b7,
205 "bisque3" => 0xcdb79e,
206 "bisque4" => 0x8b7d6b,
207 "peachpuff1" => 0xffdab9,
208 "peachpuff2" => 0xeecbad,
209 "peachpuff3" => 0xcdaf95,
210 "peachpuff4" => 0x8b7765,
211 "navajowhite1" => 0xffdead,
212 "navajowhite2" => 0xeecfa1,
213 "navajowhite3" => 0xcdb38b,
214 "navajowhite4" => 0x8b795e,
215 "lemonchiffon1" => 0xfffacd,
216 "lemonchiffon2" => 0xeee9bf,
217 "lemonchiffon3" => 0xcdc9a5,
218 "lemonchiffon4" => 0x8b8970,
219 "cornsilk1" => 0xfff8dc,
220 "cornsilk2" => 0xeee8cd,
221 "cornsilk3" => 0xcdc8b1,
222 "cornsilk4" => 0x8b8878,
223 "ivory1" => 0xfffff0,
224 "ivory2" => 0xeeeee0,
225 "ivory3" => 0xcdcdc1,
226 "ivory4" => 0x8b8b83,
227 "honeydew1" => 0xf0fff0,
228 "honeydew2" => 0xe0eee0,
229 "honeydew3" => 0xc1cdc1,
230 "honeydew4" => 0x838b83,
231 "lavenderblush1" => 0xfff0f5,
232 "lavenderblush2" => 0xeee0e5,
233 "lavenderblush3" => 0xcdc1c5,
234 "lavenderblush4" => 0x8b8386,
235 "mistyrose1" => 0xffe4e1,
236 "mistyrose2" => 0xeed5d2,
237 "mistyrose3" => 0xcdb7b5,
238 "mistyrose4" => 0x8b7d7b,
239 "azure1" => 0xf0ffff,
240 "azure2" => 0xe0eeee,
241 "azure3" => 0xc1cdcd,
242 "azure4" => 0x838b8b,
243 "slateblue1" => 0x836fff,
244 "slateblue2" => 0x7a67ee,
245 "slateblue3" => 0x6959cd,
246 "slateblue4" => 0x473c8b,
247 "royalblue1" => 0x4876ff,
248 "royalblue2" => 0x436eee,
249 "royalblue3" => 0x3a5fcd,
250 "royalblue4" => 0x27408b,
251 "blue1" => 0x0000ff,
252 "blue2" => 0x0000ee,
253 "blue3" => 0x0000cd,
254 "blue4" => 0x00008b,
255 "dodgerblue1" => 0x1e90ff,
256 "dodgerblue2" => 0x1c86ee,
257 "dodgerblue3" => 0x1874cd,
258 "dodgerblue4" => 0x104e8b,
259 "steelblue1" => 0x63b8ff,
260 "steelblue2" => 0x5cacee,
261 "steelblue3" => 0x4f94cd,
262 "steelblue4" => 0x36648b,
263 "deepskyblue1" => 0x00bfff,
264 "deepskyblue2" => 0x00b2ee,
265 "deepskyblue3" => 0x009acd,
266 "deepskyblue4" => 0x00688b,
267 "skyblue1" => 0x87ceff,
268 "skyblue2" => 0x7ec0ee,
269 "skyblue3" => 0x6ca6cd,
270 "skyblue4" => 0x4a708b,
271 "lightskyblue1" => 0xb0e2ff,
272 "lightskyblue2" => 0xa4d3ee,
273 "lightskyblue3" => 0x8db6cd,
274 "lightskyblue4" => 0x607b8b,
275 "slategray1" => 0xc6e2ff,
276 "slategray2" => 0xb9d3ee,
277 "slategray3" => 0x9fb6cd,
278 "slategray4" => 0x6c7b8b,
279 "slategrey1" => 0xc6e2ff,
280 "slategrey2" => 0xb9d3ee,
281 "slategrey3" => 0x9fb6cd,
282 "slategrey4" => 0x6c7b8b,
283 "lightsteelblue1" => 0xcae1ff,
284 "lightsteelblue2" => 0xbcd2ee,
285 "lightsteelblue3" => 0xa2b5cd,
286 "lightsteelblue4" => 0x6e7b8b,
287 "lightblue1" => 0xbfefff,
288 "lightblue2" => 0xb2dfee,
289 "lightblue3" => 0x9ac0cd,
290 "lightblue4" => 0x68838b,
291 "lightcyan1" => 0xe0ffff,
292 "lightcyan2" => 0xd1eeee,
293 "lightcyan3" => 0xb4cdcd,
294 "lightcyan4" => 0x7a8b8b,
295 "paleturquoise1" => 0xbbffff,
296 "paleturquoise2" => 0xaeeeee,
297 "paleturquoise3" => 0x96cdcd,
298 "paleturquoise4" => 0x668b8b,
299 "cadetblue1" => 0x98f5ff,
300 "cadetblue2" => 0x8ee5ee,
301 "cadetblue3" => 0x7ac5cd,
302 "cadetblue4" => 0x53868b,
303 "turquoise1" => 0x00f5ff,
304 "turquoise2" => 0x00e5ee,
305 "turquoise3" => 0x00c5cd,
306 "turquoise4" => 0x00868b,
307 "cyan1" => 0x00ffff,
308 "cyan2" => 0x00eeee,
309 "cyan3" => 0x00cdcd,
310 "cyan4" => 0x008b8b,
311 "darkslategray1" => 0x97ffff,
312 "darkslategray2" => 0x8deeee,
313 "darkslategray3" => 0x79cdcd,
314 "darkslategray4" => 0x528b8b,
315 "darkslategrey1" => 0x97ffff,
316 "darkslategrey2" => 0x8deeee,
317 "darkslategrey3" => 0x79cdcd,
318 "darkslategrey4" => 0x528b8b,
319 "aquamarine1" => 0x7fffd4,
320 "aquamarine2" => 0x76eec6,
321 "aquamarine3" => 0x66cdaa,
322 "aquamarine4" => 0x458b74,
323 "darkseagreen1" => 0xc1ffc1,
324 "darkseagreen2" => 0xb4eeb4,
325 "darkseagreen3" => 0x9bcd9b,
326 "darkseagreen4" => 0x698b69,
327 "seagreen1" => 0x54ff9f,
328 "seagreen2" => 0x4eee94,
329 "seagreen3" => 0x43cd80,
330 "seagreen4" => 0x2e8b57,
331 "palegreen1" => 0x9aff9a,
332 "palegreen2" => 0x90ee90,
333 "palegreen3" => 0x7ccd7c,
334 "palegreen4" => 0x548b54,
335 "springgreen1" => 0x00ff7f,
336 "springgreen2" => 0x00ee76,
337 "springgreen3" => 0x00cd66,
338 "springgreen4" => 0x008b45,
339 "green1" => 0x00ff00,
340 "green2" => 0x00ee00,
341 "green3" => 0x00cd00,
342 "green4" => 0x008b00,
343 "chartreuse1" => 0x7fff00,
344 "chartreuse2" => 0x76ee00,
345 "chartreuse3" => 0x66cd00,
346 "chartreuse4" => 0x458b00,
347 "olivedrab1" => 0xc0ff3e,
348 "olivedrab2" => 0xb3ee3a,
349 "olivedrab3" => 0x9acd32,
350 "olivedrab4" => 0x698b22,
351 "darkolivegreen1" => 0xcaff70,
352 "darkolivegreen2" => 0xbcee68,
353 "darkolivegreen3" => 0xa2cd5a,
354 "darkolivegreen4" => 0x6e8b3d,
355 "khaki1" => 0xfff68f,
356 "khaki2" => 0xeee685,
357 "khaki3" => 0xcdc673,
358 "khaki4" => 0x8b864e,
359 "lightgoldenrod1" => 0xffec8b,
360 "lightgoldenrod2" => 0xeedc82,
361 "lightgoldenrod3" => 0xcdbe70,
362 "lightgoldenrod4" => 0x8b814c,
363 "lightyellow1" => 0xffffe0,
364 "lightyellow2" => 0xeeeed1,
365 "lightyellow3" => 0xcdcdb4,
366 "lightyellow4" => 0x8b8b7a,
367 "yellow1" => 0xffff00,
368 "yellow2" => 0xeeee00,
369 "yellow3" => 0xcdcd00,
370 "yellow4" => 0x8b8b00,
371 "gold1" => 0xffd700,
372 "gold2" => 0xeec900,
373 "gold3" => 0xcdad00,
374 "gold4" => 0x8b7500,
375 "goldenrod1" => 0xffc125,
376 "goldenrod2" => 0xeeb422,
377 "goldenrod3" => 0xcd9b1d,
378 "goldenrod4" => 0x8b6914,
379 "darkgoldenrod1" => 0xffb90f,
380 "darkgoldenrod2" => 0xeead0e,
381 "darkgoldenrod3" => 0xcd950c,
382 "darkgoldenrod4" => 0x8b6508,
383 "rosybrown1" => 0xffc1c1,
384 "rosybrown2" => 0xeeb4b4,
385 "rosybrown3" => 0xcd9b9b,
386 "rosybrown4" => 0x8b6969,
387 "indianred1" => 0xff6a6a,
388 "indianred2" => 0xee6363,
389 "indianred3" => 0xcd5555,
390 "indianred4" => 0x8b3a3a,
391 "sienna1" => 0xff8247,
392 "sienna2" => 0xee7942,
393 "sienna3" => 0xcd6839,
394 "sienna4" => 0x8b4726,
395 "burlywood1" => 0xffd39b,
396 "burlywood2" => 0xeec591,
397 "burlywood3" => 0xcdaa7d,
398 "burlywood4" => 0x8b7355,
399 "wheat1" => 0xffe7ba,
400 "wheat2" => 0xeed8ae,
401 "wheat3" => 0xcdba96,
402 "wheat4" => 0x8b7e66,
403 "tan1" => 0xffa54f,
404 "tan2" => 0xee9a49,
405 "tan3" => 0xcd853f,
406 "tan4" => 0x8b5a2b,
407 "chocolate1" => 0xff7f24,
408 "chocolate2" => 0xee7621,
409 "chocolate3" => 0xcd661d,
410 "chocolate4" => 0x8b4513,
411 "firebrick1" => 0xff3030,
412 "firebrick2" => 0xee2c2c,
413 "firebrick3" => 0xcd2626,
414 "firebrick4" => 0x8b1a1a,
415 "brown1" => 0xff4040,
416 "brown2" => 0xee3b3b,
417 "brown3" => 0xcd3333,
418 "brown4" => 0x8b2323,
419 "salmon1" => 0xff8c69,
420 "salmon2" => 0xee8262,
421 "salmon3" => 0xcd7054,
422 "salmon4" => 0x8b4c39,
423 "lightsalmon1" => 0xffa07a,
424 "lightsalmon2" => 0xee9572,
425 "lightsalmon3" => 0xcd8162,
426 "lightsalmon4" => 0x8b5742,
427 "orange1" => 0xffa500,
428 "orange2" => 0xee9a00,
429 "orange3" => 0xcd8500,
430 "orange4" => 0x8b5a00,
431 "darkorange1" => 0xff7f00,
432 "darkorange2" => 0xee7600,
433 "darkorange3" => 0xcd6600,
434 "darkorange4" => 0x8b4500,
435 "coral1" => 0xff7256,
436 "coral2" => 0xee6a50,
437 "coral3" => 0xcd5b45,
438 "coral4" => 0x8b3e2f,
439 "tomato1" => 0xff6347,
440 "tomato2" => 0xee5c42,
441 "tomato3" => 0xcd4f39,
442 "tomato4" => 0x8b3626,
443 "orangered1" => 0xff4500,
444 "orangered2" => 0xee4000,
445 "orangered3" => 0xcd3700,
446 "orangered4" => 0x8b2500,
447 "red1" => 0xff0000,
448 "red2" => 0xee0000,
449 "red3" => 0xcd0000,
450 "red4" => 0x8b0000,
451 "deeppink1" => 0xff1493,
452 "deeppink2" => 0xee1289,
453 "deeppink3" => 0xcd1076,
454 "deeppink4" => 0x8b0a50,
455 "hotpink1" => 0xff6eb4,
456 "hotpink2" => 0xee6aa7,
457 "hotpink3" => 0xcd6090,
458 "hotpink4" => 0x8b3a62,
459 "pink1" => 0xffb5c5,
460 "pink2" => 0xeea9b8,
461 "pink3" => 0xcd919e,
462 "pink4" => 0x8b636c,
463 "lightpink1" => 0xffaeb9,
464 "lightpink2" => 0xeea2ad,
465 "lightpink3" => 0xcd8c95,
466 "lightpink4" => 0x8b5f65,
467 "palevioletred1" => 0xff82ab,
468 "palevioletred2" => 0xee799f,
469 "palevioletred3" => 0xcd6889,
470 "palevioletred4" => 0x8b475d,
471 "maroon1" => 0xff34b3,
472 "maroon2" => 0xee30a7,
473 "maroon3" => 0xcd2990,
474 "maroon4" => 0x8b1c62,
475 "violetred1" => 0xff3e96,
476 "violetred2" => 0xee3a8c,
477 "violetred3" => 0xcd3278,
478 "violetred4" => 0x8b2252,
479 "magenta1" => 0xff00ff,
480 "magenta2" => 0xee00ee,
481 "magenta3" => 0xcd00cd,
482 "magenta4" => 0x8b008b,
483 "orchid1" => 0xff83fa,
484 "orchid2" => 0xee7ae9,
485 "orchid3" => 0xcd69c9,
486 "orchid4" => 0x8b4789,
487 "plum1" => 0xffbbff,
488 "plum2" => 0xeeaeee,
489 "plum3" => 0xcd96cd,
490 "plum4" => 0x8b668b,
491 "mediumorchid1" => 0xe066ff,
492 "mediumorchid2" => 0xd15fee,
493 "mediumorchid3" => 0xb452cd,
494 "mediumorchid4" => 0x7a378b,
495 "darkorchid1" => 0xbf3eff,
496 "darkorchid2" => 0xb23aee,
497 "darkorchid3" => 0x9a32cd,
498 "darkorchid4" => 0x68228b,
499 "purple1" => 0x9b30ff,
500 "purple2" => 0x912cee,
501 "purple3" => 0x7d26cd,
502 "purple4" => 0x551a8b,
503 "mediumpurple1" => 0xab82ff,
504 "mediumpurple2" => 0x9f79ee,
505 "mediumpurple3" => 0x8968cd,
506 "mediumpurple4" => 0x5d478b,
507 "thistle1" => 0xffe1ff,
508 "thistle2" => 0xeed2ee,
509 "thistle3" => 0xcdb5cd,
510 "thistle4" => 0x8b7b8b,
511 "gray0" => 0x000000,
512 "gray1" => 0x030303,
513 "gray2" => 0x050505,
514 "gray3" => 0x080808,
515 "gray4" => 0x0a0a0a,
516 "gray5" => 0x0d0d0d,
517 "gray6" => 0x0f0f0f,
518 "gray7" => 0x121212,
519 "gray8" => 0x141414,
520 "gray9" => 0x171717,
521 "gray10" => 0x1a1a1a,
522 "gray11" => 0x1c1c1c,
523 "gray12" => 0x1f1f1f,
524 "gray13" => 0x212121,
525 "gray14" => 0x242424,
526 "gray15" => 0x262626,
527 "gray16" => 0x292929,
528 "gray17" => 0x2b2b2b,
529 "gray18" => 0x2e2e2e,
530 "gray19" => 0x303030,
531 "gray20" => 0x333333,
532 "gray21" => 0x363636,
533 "gray22" => 0x383838,
534 "gray23" => 0x3b3b3b,
535 "gray24" => 0x3d3d3d,
536 "gray25" => 0x404040,
537 "gray26" => 0x424242,
538 "gray27" => 0x454545,
539 "gray28" => 0x474747,
540 "gray29" => 0x4a4a4a,
541 "gray30" => 0x4d4d4d,
542 "gray31" => 0x4f4f4f,
543 "gray32" => 0x525252,
544 "gray33" => 0x545454,
545 "gray34" => 0x575757,
546 "gray35" => 0x595959,
547 "gray36" => 0x5c5c5c,
548 "gray37" => 0x5e5e5e,
549 "gray38" => 0x616161,
550 "gray39" => 0x636363,
551 "gray40" => 0x666666,
552 "gray41" => 0x696969,
553 "gray42" => 0x6b6b6b,
554 "gray43" => 0x6e6e6e,
555 "gray44" => 0x707070,
556 "gray45" => 0x737373,
557 "gray46" => 0x757575,
558 "gray47" => 0x787878,
559 "gray48" => 0x7a7a7a,
560 "gray49" => 0x7d7d7d,
561 "gray50" => 0x7f7f7f,
562 "gray51" => 0x828282,
563 "gray52" => 0x858585,
564 "gray53" => 0x878787,
565 "gray54" => 0x8a8a8a,
566 "gray55" => 0x8c8c8c,
567 "gray56" => 0x8f8f8f,
568 "gray57" => 0x919191,
569 "gray58" => 0x949494,
570 "gray59" => 0x969696,
571 "gray60" => 0x999999,
572 "gray61" => 0x9c9c9c,
573 "gray62" => 0x9e9e9e,
574 "gray63" => 0xa1a1a1,
575 "gray64" => 0xa3a3a3,
576 "gray65" => 0xa6a6a6,
577 "gray66" => 0xa8a8a8,
578 "gray67" => 0xababab,
579 "gray68" => 0xadadad,
580 "gray69" => 0xb0b0b0,
581 "gray70" => 0xb3b3b3,
582 "gray71" => 0xb5b5b5,
583 "gray72" => 0xb8b8b8,
584 "gray73" => 0xbababa,
585 "gray74" => 0xbdbdbd,
586 "gray75" => 0xbfbfbf,
587 "gray76" => 0xc2c2c2,
588 "gray77" => 0xc4c4c4,
589 "gray78" => 0xc7c7c7,
590 "gray79" => 0xc9c9c9,
591 "gray80" => 0xcccccc,
592 "gray81" => 0xcfcfcf,
593 "gray82" => 0xd1d1d1,
594 "gray83" => 0xd4d4d4,
595 "gray84" => 0xd6d6d6,
596 "gray85" => 0xd9d9d9,
597 "gray86" => 0xdbdbdb,
598 "gray87" => 0xdedede,
599 "gray88" => 0xe0e0e0,
600 "gray89" => 0xe3e3e3,
601 "gray90" => 0xe5e5e5,
602 "gray91" => 0xe8e8e8,
603 "gray92" => 0xebebeb,
604 "gray93" => 0xededed,
605 "gray94" => 0xf0f0f0,
606 "gray95" => 0xf2f2f2,
607 "gray96" => 0xf5f5f5,
608 "gray97" => 0xf7f7f7,
609 "gray98" => 0xfafafa,
610 "gray99" => 0xfcfcfc,
611 "gray100" => 0xffffff,
612 "grey0" => 0x000000,
613 "grey1" => 0x030303,
614 "grey2" => 0x050505,
615 "grey3" => 0x080808,
616 "grey4" => 0x0a0a0a,
617 "grey5" => 0x0d0d0d,
618 "grey6" => 0x0f0f0f,
619 "grey7" => 0x121212,
620 "grey8" => 0x141414,
621 "grey9" => 0x171717,
622 "grey10" => 0x1a1a1a,
623 "grey11" => 0x1c1c1c,
624 "grey12" => 0x1f1f1f,
625 "grey13" => 0x212121,
626 "grey14" => 0x242424,
627 "grey15" => 0x262626,
628 "grey16" => 0x292929,
629 "grey17" => 0x2b2b2b,
630 "grey18" => 0x2e2e2e,
631 "grey19" => 0x303030,
632 "grey20" => 0x333333,
633 "grey21" => 0x363636,
634 "grey22" => 0x383838,
635 "grey23" => 0x3b3b3b,
636 "grey24" => 0x3d3d3d,
637 "grey25" => 0x404040,
638 "grey26" => 0x424242,
639 "grey27" => 0x454545,
640 "grey28" => 0x474747,
641 "grey29" => 0x4a4a4a,
642 "grey30" => 0x4d4d4d,
643 "grey31" => 0x4f4f4f,
644 "grey32" => 0x525252,
645 "grey33" => 0x545454,
646 "grey34" => 0x575757,
647 "grey35" => 0x595959,
648 "grey36" => 0x5c5c5c,
649 "grey37" => 0x5e5e5e,
650 "grey38" => 0x616161,
651 "grey39" => 0x636363,
652 "grey40" => 0x666666,
653 "grey41" => 0x696969,
654 "grey42" => 0x6b6b6b,
655 "grey43" => 0x6e6e6e,
656 "grey44" => 0x707070,
657 "grey45" => 0x737373,
658 "grey46" => 0x757575,
659 "grey47" => 0x787878,
660 "grey48" => 0x7a7a7a,
661 "grey49" => 0x7d7d7d,
662 "grey50" => 0x7f7f7f,
663 "grey51" => 0x828282,
664 "grey52" => 0x858585,
665 "grey53" => 0x878787,
666 "grey54" => 0x8a8a8a,
667 "grey55" => 0x8c8c8c,
668 "grey56" => 0x8f8f8f,
669 "grey57" => 0x919191,
670 "grey58" => 0x949494,
671 "grey59" => 0x969696,
672 "grey60" => 0x999999,
673 "grey61" => 0x9c9c9c,
674 "grey62" => 0x9e9e9e,
675 "grey63" => 0xa1a1a1,
676 "grey64" => 0xa3a3a3,
677 "grey65" => 0xa6a6a6,
678 "grey66" => 0xa8a8a8,
679 "grey67" => 0xababab,
680 "grey68" => 0xadadad,
681 "grey69" => 0xb0b0b0,
682 "grey70" => 0xb3b3b3,
683 "grey71" => 0xb5b5b5,
684 "grey72" => 0xb8b8b8,
685 "grey73" => 0xbababa,
686 "grey74" => 0xbdbdbd,
687 "grey75" => 0xbfbfbf,
688 "grey76" => 0xc2c2c2,
689 "grey77" => 0xc4c4c4,
690 "grey78" => 0xc7c7c7,
691 "grey79" => 0xc9c9c9,
692 "grey80" => 0xcccccc,
693 "grey81" => 0xcfcfcf,
694 "grey82" => 0xd1d1d1,
695 "grey83" => 0xd4d4d4,
696 "grey84" => 0xd6d6d6,
697 "grey85" => 0xd9d9d9,
698 "grey86" => 0xdbdbdb,
699 "grey87" => 0xdedede,
700 "grey88" => 0xe0e0e0,
701 "grey89" => 0xe3e3e3,
702 "grey90" => 0xe5e5e5,
703 "grey91" => 0xe8e8e8,
704 "grey92" => 0xebebeb,
705 "grey93" => 0xededed,
706 "grey94" => 0xf0f0f0,
707 "grey95" => 0xf2f2f2,
708 "grey96" => 0xf5f5f5,
709 "grey97" => 0xf7f7f7,
710 "grey98" => 0xfafafa,
711 "grey99" => 0xfcfcfc,
712 "grey100" => 0xffffff,
713 "darkgrey" => 0xa9a9a9,
714 "darkgray" => 0xa9a9a9,
715 "darkblue" => 0x00008b,
716 "darkcyan" => 0x008b8b,
717 "darkmagenta" => 0x8b008b,
718 "darkred" => 0x8b0000,
719 "lightgreen" => 0x90ee90,
720 };
721 }
722
723 1;
724
725 __END__
726
00 package Graphics::ColorNames;
11 use 5.006;
22
3 use base "Exporter";
3 # ABSTRACT: defines RGB values for common color names
44
55 use strict;
66 use warnings;
77
8 # use AutoLoader;
8 use v5.10;
9
10 use Exporter qw/ import /;
11
912 use Carp;
13 use File::Spec::Functions qw/ file_name_is_absolute /;
1014 use Module::Load 0.10;
1115 use Module::Loaded;
1216
13 our $VERSION = '2.11';
14 # $VERSION = eval $VERSION;
17 our $VERSION = 'v3.5.0';
1518
1619 our %EXPORT_TAGS = (
17 'all' => [ qw( hex2tuple tuple2hex all_schemes ) ],
18 'utility' => [ qw( hex2tuple tuple2hex ) ],
20 'all' => [qw( hex2tuple tuple2hex all_schemes )],
21 'utility' => [qw( hex2tuple tuple2hex )],
1922 );
20 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
21 our @EXPORT = ( );
23 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
24 our @EXPORT = ();
25
26 sub VERSION {
27 my ( $class, $wanted ) = @_;
28 require version;
29 return version->parse($VERSION);
30 }
2231
2332 # We store Schemes in a hash as a quick-and-dirty way to filter
2433 # duplicates (which sometimes occur when directories are repeated in
2534 # @INC or via symlinks). The order does not matter.
2635
27 # If we use AutoLoader, these should be use vars() ?
28
29 my %FoundSchemes = ( );
30
31 # Since 2.10_02, we've added autoloading color names to the object-
32 # oriented interface.
33
34 our $AUTOLOAD;
35
36 sub AUTOLOAD {
37 $AUTOLOAD =~ /^(.*:)*([\w\_]+)$/;
38 my $name = $2;
39 my $hex = (my $self = $_[0])->FETCH($name);
40 if (defined $hex) {
41 return $hex;
42 }
43 else {
44 croak "No method or color named $name";
45 # $AutoLoader::AUTOLOAD = $AUTOLOAD;
46 # goto &AutoLoader::AUTOLOAD;
47 }
48 }
49
36 my %FoundSchemes = ();
5037
5138 sub _load {
52 while(my $module = shift) {
53 unless (is_loaded($module)) {
54 load($module);
55 mark_as_loaded($module) unless (is_loaded($module));
56 }
57 }
39 while ( my $module = shift ) {
40 unless ( is_loaded($module) ) {
41 load($module);
42 mark_as_loaded($module) unless ( is_loaded($module) );
43 }
44 }
5845 }
5946
6047 # TODO - see if using Tie::Hash::Layered gives an improvement
6148
6249 sub _load_scheme_from_module {
63 my $self = shift;
64 my $base = __PACKAGE__;
65
66 my $module = join('::', $base, (my $scheme = shift));
67 eval { _load($module); };
68 if ($@) {
69 eval { _load($module = $scheme); };
50 my ($self, $scheme) = @_;
51
52 my $module =
53 $scheme =~ /^\+/ ? substr( $scheme, 1 )
54 : $scheme =~ /^Color::Library::Dictionary::/ ? $scheme
55 : __PACKAGE__ . '::' . $scheme;
56
57 eval { _load($module); };
7058 if ($@) {
71 croak "Cannot load color naming scheme \`$module\'";
72 }
73 }
74
75 {
76 no strict 'refs';
77 if ($module =~ $base) {
78 $self->load_scheme($module->NamesRgbTable);
79 }
80 elsif ($module =~ /Color::Library::Dictionary/) {
81 $self->load_scheme($module->_load_color_list);
59 croak "Cannot load color naming scheme module $module";
60 }
61
62 if ($module->can('NamesRgbTable')) {
63 $self->load_scheme( $module->NamesRgbTable );
64 }
65 elsif ($module->can('_load_color_list')) {
66 $self->load_scheme( $module->_load_color_list );
8267 }
8368 else {
84 croak "Unknown scheme type: $module";
85 }
86 }
69 croak "Unknown scheme type: $module";
70 }
8771 }
8872
8973 sub TIEHASH {
90 my $class = shift || __PACKAGE__;
91 my $self = {
92 _schemes => [ ],
93 _iterator => 0,
94 };
95
96 bless $self, $class;
97
98 if (@_) {
99 foreach my $scheme (@_) {
100 if (ref $scheme) {
101 $self->load_scheme( $scheme );
102 }
103 elsif (-r $scheme) {
104 $self->_load_scheme_from_file( $scheme );
105 }
106 else {
107 $self->_load_scheme_from_module( $scheme );
108 }
109 }
110 } else {
111 $self->_load_scheme_from_module('X');
112 }
113
114 return $self;
74 my $class = shift || __PACKAGE__;
75 my $self = {
76 _schemes => [],
77 _iterator => 0,
78 };
79
80 bless $self, $class;
81
82 if (@_) {
83 foreach my $scheme (@_) {
84 if ( ref $scheme ) {
85 $self->load_scheme($scheme);
86 }
87 elsif ($scheme =~ /^\+?(?:\w+[:][:])*\w+$/) {
88 $self->_load_scheme_from_module($scheme);
89 }
90 elsif ( file_name_is_absolute($scheme) ) {
91 $self->_load_scheme_from_file($scheme);
92 }
93 else {
94 croak "Unknown color scheme: $scheme";
95 }
96 }
97 }
98 else {
99 $self->_load_scheme_from_module('X');
100 }
101
102 return $self;
115103 }
116104
117105 sub FETCH {
118 my $self = shift;
119 my $key = lc(shift||"");
120
121 # If we're passing it an RGB value, return that value
122
123 if ($key =~ m/^\x23?([\da-f]{6})$/) {
124 return $1;
125 } else {
126
127 $key =~ s/[^a-z\d\%]//g; # ignore non-word characters
128
129 my $val = undef;
130 my $i = 0;
131 while ((!defined $val) && ($i < @{$self->{_schemes}})) {
132 $val = $self->{_schemes}->[$i++]->{$key};
133 }
134
135 if (defined $val) {
136 return sprintf('%06x', $val ), ;
137 } else {
138 return;
139 }
140 }
106 my $self = shift;
107 my $key = lc( shift || "" );
108
109 # If we're passing it an RGB value, return that value
110
111 if ( $key =~ m/^(?:\x23|0x)?([0-9a-f]{6})$/ ) {
112 return $1;
113 }
114 else {
115
116 $key =~ s/[^0-9a-z\%]//g; # ignore non-word characters
117
118 my $val = undef;
119 my $i = 0;
120 while ( ( !defined $val ) && ( $i < @{ $self->{_schemes} } ) ) {
121 $val = $self->{_schemes}->[ $i++ ]->{$key};
122 }
123
124 if ( defined $val ) {
125 return sprintf( '%06x', $val ),;
126 }
127 else {
128 return;
129 }
130 }
141131 }
142132
143133 sub EXISTS {
144 my ($self, $key) = @_;
145 defined ($self->FETCH($key));
134 my ( $self, $key ) = @_;
135 defined( $self->FETCH($key) );
146136 }
147137
148138 sub FIRSTKEY {
149 (my $self = shift)->{_iterator} = 0;
150 each %{$self->{_schemes}->[$self->{_iterator}]};
139 ( my $self = shift )->{_iterator} = 0;
140 each %{ $self->{_schemes}->[ $self->{_iterator} ] };
151141 }
152142
153143 sub NEXTKEY {
154 my $self = shift;
155 my ($key, $val) = each %{$self->{_schemes}->[$self->{_iterator}]};
156 unless (defined $key) {
157 ($key, $val) = each %{$self->{_schemes}->[++$self->{_iterator}]};
158 }
159 return $key;
144 my $self = shift;
145 my ( $key, $val ) = each %{ $self->{_schemes}->[ $self->{_iterator} ] };
146 unless ( defined $key ) {
147 ( $key, $val ) = each %{ $self->{_schemes}->[ ++$self->{_iterator} ] };
148 }
149 return $key;
160150 }
161151
162152 sub load_scheme {
163 my $self = shift;
164 my $scheme = shift;
165
166 if (ref($scheme) eq "HASH") {
167 push @{$self->{_schemes}}, $scheme;
168 }
169 elsif (ref($scheme) eq "CODE") {
170 _load("Tie::Sub");
171 push @{$self->{_schemes}}, { };
172 tie %{$self->{_schemes}->[-1]}, 'Tie::Sub', $scheme;
173 }
174 elsif (ref($scheme) eq "ARRAY") {
175 # assumes these are Color::Library::Dictionary 0.02 files
176 my $s = { };
177 foreach my $rec (@$scheme) {
178 my $key = $rec->[0];
179 my $name = $rec->[1];
180 my $code = $rec->[5];
181 $name =~ s/[\W\_]//g; # ignore non-word characters
182 $s->{$name} = $code unless (exists $s->{$name});
183 if ($key =~ /^(.+\:.+)\.(\d+)$/) {
184 $s->{"$name$2"} = $code;
185 }
186 }
187 push @{$self->{_schemes}}, $s;
188 }
189 else {
190 # TODO - use Exception
191 undef $!;
192 eval {
193 if ((ref($scheme) eq 'GLOB')
194 || ref($scheme) eq "IO::File" || $scheme->isa('IO::File')
195 || ref($scheme) eq "FileHandle" || $scheme->isa('FileHandle')) {
196 $self->_load_scheme_from_file($scheme);
197 }
198 };
199 if ($@) {
200 croak "Error $@ on scheme type ", ref($scheme);
201 }
202 elsif ($!) {
203 croak "$!";
153 my $self = shift;
154 my $scheme = shift;
155
156 if ( ref($scheme) eq "HASH" ) {
157 push @{ $self->{_schemes} }, $scheme;
158 }
159 elsif ( ref($scheme) eq "CODE" ) {
160 _load("Tie::Sub");
161 push @{ $self->{_schemes} }, {};
162 tie %{ $self->{_schemes}->[-1] }, 'Tie::Sub', $scheme;
163 }
164 elsif ( ref($scheme) eq "ARRAY" ) {
165
166 # assumes these are Color::Library::Dictionary 0.02 files
167 my $s = {};
168 foreach my $rec (@$scheme) {
169 my $key = $rec->[0];
170 my $name = $rec->[1];
171 my $code = $rec->[5];
172 $name =~ s/[\W\_]//g; # ignore non-word characters
173 $s->{$name} = $code unless ( exists $s->{$name} );
174 if ( $key =~ /^(.+\:.+)\.([0-9]+)$/ ) {
175 $s->{"$name$2"} = $code;
176 }
177 }
178 push @{ $self->{_schemes} }, $s;
204179 }
205180 else {
206 # everything is ok?
207 }
208 }
181 # TODO - use Exception
182 undef $!;
183 eval {
184 if ( ( ref($scheme) eq 'GLOB' )
185 || ref($scheme) eq "IO::File"
186 || $scheme->isa('IO::File')
187 || ref($scheme) eq "FileHandle"
188 || $scheme->isa('FileHandle') )
189 {
190 $self->_load_scheme_from_file($scheme);
191 }
192 };
193 if ($@) {
194 croak "Error $@ on scheme type ", ref($scheme);
195 }
196 elsif ($!) {
197 croak "$!";
198 }
199 else {
200 # everything is ok?
201 }
202 }
209203 }
210204
211205 sub _find_schemes {
215209 # BUG: deep-named schemes such as Graphics::ColorNames::Foo::Bar
216210 # are not supported.
217211
218 if (-d $path) {
219 my $dh = DirHandle->new( $path )
220 || croak "Unable to access directory $path";
221 while (defined(my $fn = $dh->read)) {
222 if ((-r File::Spec->catdir($path, $fn)) && ($fn =~ /(.+)\.pm$/)) {
223 $FoundSchemes{$1}++;
224 }
225 }
226 }
227 }
212 if ( -d $path ) {
213 my $dh = DirHandle->new($path)
214 || croak "Unable to access directory $path";
215 while ( defined( my $fn = $dh->read ) ) {
216 if ( ( -r File::Spec->catdir( $path, $fn ) )
217 && ( $fn =~ /(.+)\.pm$/ ) )
218 {
219 $FoundSchemes{$1}++;
220 }
221 }
222 }
223 }
228224
229225 sub _readonly_error {
230 croak "Cannot modify a read-only value";
226 croak "Cannot modify a read-only value";
231227 }
232228
233229 sub DESTROY {
234 my $self = shift;
235 delete $self->{_schemes};
236 delete $self->{_iterator};
237 }
238
239 sub UNTIE { # stub to avoid AUTOLOAD
230 my $self = shift;
231 delete $self->{_schemes};
232 delete $self->{_iterator};
240233 }
241234
242235 BEGIN {
243 no strict 'refs';
244 *STORE = \ &_readonly_error;
245 *DELETE = \ &_readonly_error;
246 *CLEAR = \ &_readonly_error; # causes problems with 'undef'
247
248 *new = \ &TIEHASH;
249 }
250
251
252 1;
253
254 ## __END__
236 no strict 'refs';
237 *STORE = \&_readonly_error;
238 *DELETE = \&_readonly_error;
239 *CLEAR = \&_readonly_error; # causes problems with 'undef'
240
241 *new = \&TIEHASH;
242 }
255243
256244 # Convert 6-digit hexidecimal code (used for HTML etc.) to an array of
257245 # RGB values
258246
259247 sub hex2tuple {
260 my $rgb = CORE::hex( shift );
261 my ($red, $green, $blue);
262 $blue = ($rgb & 0x0000ff);
263 $green = ($rgb & 0x00ff00) >> 8;
264 $red = ($rgb & 0xff0000) >> 16;
265 return ($red, $green, $blue);
266 }
267
248 my $rgb = CORE::hex(shift);
249 my ( $red, $green, $blue );
250 $blue = ( $rgb & 0x0000ff );
251 $green = ( $rgb & 0x00ff00 ) >> 8;
252 $red = ( $rgb & 0xff0000 ) >> 16;
253 return ( $red, $green, $blue );
254 }
268255
269256 # Convert list of RGB values to 6-digit hexidecimal code (used for HTML, etc.)
270257
271258 sub tuple2hex {
272 my ($red, $green, $blue) = @_;
273 my $rgb = sprintf "%.2x%.2x%.2x", $red, $green, $blue;
274 return $rgb;
259 my ( $red, $green, $blue ) = @_;
260 my $rgb = sprintf "%.2x%.2x%.2x", $red, $green, $blue;
261 return $rgb;
275262 }
276263
277264 sub all_schemes {
278265 unless (%FoundSchemes) {
279
280 _load("DirHandle", "File::Spec");
281
282 foreach my $dir (@INC) {
283 _find_schemes(
284 File::Spec->catdir($dir, split(/::/, __PACKAGE__)));
285 }
286 }
287 return (keys %FoundSchemes);
288 }
266
267 _load( "DirHandle", "File::Spec" );
268
269 foreach my $dir (@INC) {
270 _find_schemes(
271 File::Spec->catdir( $dir, split( /::/, __PACKAGE__ ) ) );
272 }
273 }
274 return ( keys %FoundSchemes );
275 }
289276
290277 sub _load_scheme_from_file {
291 my $self = shift;
292 my $file = shift;
293
294 unless (ref $file) {
295 unless (-r $file) {
296 croak "Cannot load scheme from file: \'$file\'";
297 }
298 _load("IO::File");
299 }
300
301 my $fh = ref($file) ? $file : (IO::File->new);
302 unless (ref $file) {
303 open($fh, $file)
304 || croak "Cannot open file: \'$file\'";
305 }
306
307 my $scheme = { };
308
309 while (my $line = <$fh>) {
310 chomp($line);
311 $line =~ s/[\!\#].*$//;
312 if ($line ne "") {
313 my $name = lc(substr($line, 12));
314 $name =~ s/[\W]//g; # remove anything that isn't a letter or number
315
316 croak "Missing color name",
317 unless ($name ne "");
318
319 # TODO? Should we add an option to warn if overlapping names
320 # are defined? This seems to be too common to be useful.
321
322 # unless (exists $scheme->{$name}) {
323
324 $scheme->{$name} = 0;
325 foreach (0, 4, 8) {
326 $scheme->{$name} <<= 8;
327 $scheme->{$name} |= (eval substr($line, $_, 3));
328 }
329
330 # }
331 }
332 }
333 $self->load_scheme( $scheme );
334
335 unless (ref $file) {
336 close $fh;
337 }
338 }
339
278 my $self = shift;
279 my $file = shift;
280
281 unless ( ref $file ) {
282 unless ( -r $file ) {
283 croak "Cannot load scheme from file: \'$file\'";
284 }
285 _load("IO::File");
286 }
287
288 my $fh = ref($file) ? $file : ( IO::File->new );
289 unless ( ref $file ) {
290 open( $fh, $file )
291 || croak "Cannot open file: \'$file\'";
292 }
293
294 my $scheme = {};
295
296 while ( my $line = <$fh> ) {
297 chomp($line);
298 $line =~ s/[\!\#].*$//;
299 if ( $line ne "" ) {
300 my $name = lc( substr( $line, 12 ) );
301 $name =~ s/[\W]//g; # remove anything that isn't a letter or number
302
303 croak "Missing color name",
304 unless ( $name ne "" );
305
306 # TODO? Should we add an option to warn if overlapping names
307 # are defined? This seems to be too common to be useful.
308
309 # unless (exists $scheme->{$name}) {
310
311 $scheme->{$name} = 0;
312 foreach ( 0, 4, 8 ) {
313 $scheme->{$name} <<= 8;
314 $scheme->{$name} |= ( eval substr( $line, $_, 3 ) );
315 }
316
317 # }
318 }
319 }
320 $self->load_scheme($scheme);
321
322 unless ( ref $file ) {
323 close $fh;
324 }
325 }
340326
341327 sub hex {
342 my $self = shift;
343 my $rgb = $self->FETCH(my $name = shift);
344 my $pre = shift || "";
345 return ($pre.$rgb);
328 my ($self, $name, $prefix) = @_;
329 my $rgb = $self->FETCH($name);
330
331 return '' unless defined $rgb;
332
333 return $rgb unless defined $prefix;
334
335 return $prefix . $rgb;
346336 }
347337
348338 sub rgb {
349 my $self = shift;
350 my @rgb = hex2tuple($self->FETCH(my $name = shift));
351 my $sep = shift || ','; # (*)
352 return wantarray ? @rgb : join($sep,@rgb);
353 # (*) A possible bug, if one uses "0" as a separator. But this is not likely
354 }
339 my ($self, $name, $separator) = @_;
340 my $rgb = $self->FETCH($name);
341 my @rgb = (defined $rgb) ? hex2tuple( $rgb ) : ();
342 return wantarray ? @rgb : join($separator || ',', @rgb);
343 }
344
345 1;
355346
356347 __END__
357348
349 =pod
350
351 =encoding UTF-8
352
358353 =head1 NAME
359354
360355 Graphics::ColorNames - defines RGB values for common color names
361356
362 =begin readme
363
364 =head1 REQUIREMENTS
365
366 C<Graphics::ColorNames> should work on Perl 5.6.0. It requires the
367 following non-core (depending on your Perl version) modules:
368
369 Module::Load
370 Module::Loaded
371
372 The following modules are not required for using most features but
373 are recommended:
374
375 Color::Library
376 Tie::Sub
377
378 L<Installation|/INSTALLATION> requires the following testing modules:
379
380 Test::Exception
381 Test::More
382
383 If the C<DEVEL_TESTS> environment variable is set, the tests will also
384 use the following modules for running developer tests, if they are
385 installed:
386
387 Test::Pod
388 Test::Pod::Coverage
389 Test::Portability::Files
390
391 The developer tests are for quality-control purposes.
392
393 =head1 INSTALLATION
394
395 Installation can be done using the traditional Makefile.PL or the newer
396 Build.PL methods.
397
398 Using Makefile.PL:
399
400 perl Makefile.PL
401 make test
402 make install
403
404 (On Windows platforms you should use C<nmake> instead.)
405
406 Using Build.PL (if you have L<Module::Build> installed):
407
408 perl Build.PL
409 perl Build test
410 perl Build install
411
412 =end readme
357 =head1 VERSION
358
359 version v3.5.0
413360
414361 =head1 SYNOPSIS
415362
416 use Graphics::ColorNames 2.10;
417
418 $po = new Graphics::ColorNames(qw( X ));
419
420 $rgb = $po->hex('green'); # returns '00ff00'
421 $rgb = $po->hex('green', '0x'); # returns '0x00ff00'
422 $rgb = $po->hex('green', '#'); # returns '#00ff00'
423
424 $rgb = $po->rgb('green'); # returns '0,255,0'
425 @rgb = $po->rgb('green'); # returns (0, 255, 0)
426
427 $rgb = $po->green; # same as $po->hex('green');
428
429 tie %ph, 'Graphics::ColorNames', (qw( X ));
430
431 $rgb = $ph{green}; # same as $po->hex('green');
363 use Graphics::ColorNames;
364 use Graphics::ColorNames::WWW;
365
366 $pal = Graphics::ColorNames->new( qw[ X WWW ] );
367
368 $rgb = $pal->hex('green'); # returns '00ff00'
369 $rgb = $pal->hex('green', '0x'); # returns '0x00ff00'
370 $rgb = $pal->hex('green', '#'); # returns '#00ff00'
371
372 $rgb = $pal->rgb('green'); # returns '0,255,0'
373 @rgb = $pal->rgb('green'); # returns (0, 255, 0)
432374
433375 =head1 DESCRIPTION
434376
439381 whenever they decide to give the users the option of specifying a
440382 color by name rather than RGB value.
441383
442 =begin readme
443
444 See the module POD for complete documentation.
445
446 =end readme
447
448 =for readme stop
449
450 For example,
451
452 use Graphics::ColorNames 2.10;
453
454 use GD;
455
456 $pal = new Graphics::ColorNames;
457
458 $img = new GD::Image(100, 100);
459
460 $bgColor = $img->colorAllocate( $pal->rgb('CadetBlue3') );
461
462 Although this is a little "bureaucratic", the meaning of this code is clear:
463 C<$bgColor> (or background color) is 'CadetBlue3' (which is easier to for one
464 to understand than C<0x7A, 0xC5, 0xCD>). The variable is named for its
465 function, not form (ie, C<$CadetBlue3>) so that if the author later changes
466 the background color, the variable name need not be changed.
467
468 You can also define L</Custom Color Schemes> for specialised palettes
469 for websites or institutional publications:
470
471 $color = $pal->hex('MenuBackground');
472
473 As an added feature, a hexidecimal RGB value in the form of #RRGGBB,
474 0xRRGGBB or RRGGBB will return itself:
475
476 $color = $pal->hex('#123abc'); # returns '123abc'
477
478 =head2 Tied Interface
479
480 The standard interface (prior to version 0.40) is through a tied hash:
481
482 tie %pal, 'Graphics::ColorNames', @schemes;
483
484 where C<%pal> is the tied hash and C<@schemes> is a list of
485 L<color schemes|/Color Schemes>.
384 =head1 METHODS
385
386 =head2 C<new>
387
388 The constructor is as follows:
389
390 my $pal = Graphics::ColorNames->new( @schemes );
391
392 where C<@schemes> is an array of color schemes (palettes, dictionaries).
486393
487394 A valid color scheme may be the name of a color scheme (such as C<X>
488395 or a full module name such as C<Graphics::ColorNames::X>), a reference
489396 to a color scheme hash or subroutine, or to the path or open
490397 filehandle for a F<rgb.txt> file.
491398
492 As of version 2.1002, one can also use L<Color::Library> dictionaries:
493
494 tie %pal, 'Graphics::ColorNames', qw(Color::Library::Dictionary::HTML);
495
496 This is an experimental feature which may change in later versions (see
497 L</SEE ALSO> for a discussion of the differences between modules).
498
499 Multiple schemes can be used:
500
501 tie %pal, 'Graphics::ColorNames', qw(HTML Netscape);
502
503 In this case, if the name is not a valid HTML color, the Netscape name
504 will be used.
505
506 One can load all available schemes in the Graphics::ColorNames namespace
507 (as of version 2.0):
508
509 use Graphics::ColorNames 2.0, 'all_schemes';
510 tie %NameTable, 'Graphics::ColorNames', all_schemes();
511
512 When multiple color schemes define the same name, then the earlier one
513 listed has priority (however, hash-based color schemes always have
514 priority over code-based color schemes).
515
516 When no color scheme is specified, the X-Windows scheme is assumed.
517
518 Color names are case insensitive, and spaces or punctuation
519 are ignored. So "Alice Blue" returns the same
520 value as "aliceblue", "ALICE-BLUE" and "a*lICEbl-ue". (If you are
521 using color names based on user input, you may want to add additional
522 validation of the color names.)
399 If none are specified, it uses the default C<X> color scheme, which
400 corresponds to the X-Windows F<rgb.txt> colors. For most purposes,
401 this is good enough. Since v3.2.0, it was updated to use the
402 2014-07-06 colors, so includes the standard CSS colors as well.
403
404 Other color schemes are available on CPAN,
405 e.g. L<Graphics::ColorNames::WWW>.
406
407 Since version 2.1002, L<Color::Library> dictionaries can be used as
408 well:
409
410 my $pal = Graphics::ColorNames->new( 'Color::Library::Dictionary::HTML' );
411
412 =head2 C<rgb>
413
414 @rgb = $pal->rgb($name);
415
416 $rgb = $pal->rgb($name, $separator);
417
418 If called in a list context, returns a triplet.
419
420 If called in a scalar context, returns a string separated by an
421 optional separator (which defauls to a comma). For example,
422
423 @rgb = $pal->rgb('blue'); # returns (0, 0, 255)
424
425 $rgb = $pal->rgb('blue', ','); # returns "0,0,255"
426
427 Unknown color names return empty lists or strings, depending on the
428 context.
429
430 Color names are case insensitive, and spaces or punctuation are
431 ignored. So "Alice Blue" returns the same value as "aliceblue",
432 "ALICE-BLUE" and "a*lICEbl-ue". (If you are using color names based
433 on user input, you should add additional validation of the color
434 names.)
523435
524436 The value returned is in the six-digit hexidecimal format used in HTML and
525437 CSS (without the initial '#'). To convert it to separate red, green, and
526438 blue values (between 0 and 255), use the L</hex2tuple> function.
527439
528 =head2 Object-Oriented Interface
529
530 If you prefer, an object-oriented interface is available:
531
532 use Graphics::ColorNames 0.40;
533
534 $obj = Graphics::ColorNames->new('/etc/rgb.txt');
535
536 $hex = $obj->hex('skyblue'); # returns "87ceeb"
537 @rgb = $obj->rgb('skyblue'); # returns (0x87, 0xce, 0xeb)
538
539 The interface is similar to the L<Color::Rgb> module:
540
541 =over
542
543 =item new
544
545 $obj = Graphics::ColorNames->new( @SCHEMES );
546
547 Creates the object, using the default L<color schemes|/Color Schemes>.
548 If none are specified, it uses the C<X> scheme.
549
550 =item load_scheme
551
552 $obj->load_scheme( $scheme );
553
554 Loads a scheme dynamically. The scheme may be any hash or code reference.
555
556 =item hex
557
558 $hex = $obj->hex($name, $prefix);
440 You may also specify an absolute filename as a color scheme, if the file
441 is in the same format as the standard F<rgb.txt> file.
442
443 =head2 C<hex>
444
445 $hex = $pal->hex($name, $prefix);
559446
560447 Returns a 6-digit hexidecimal RGB code for the color. If an optional
561448 prefix is specified, it will prefix the code with that string. For
562449 example,
563450
564 $hex = $obj->hex('blue', '#'); # returns "#0000ff"
565
566 =item rgb
567
568 @rgb = $obj->rgb($name);
569
570 $rgb = $obj->rgb($name, $separator);
571
572 If called in a list context, returns a triplet.
573
574 If called in a scalar context, returns a string separated by an
575 optional separator (which defauls to a comma). For example,
576
577 @rgb = $obj->rgb('blue'); # returns (0, 0, 255)
578
579 $rgb = $obj->rgb('blue', ','); # returns "0,0,255"
580
581 =back
582
583 Since version 2.10_02, the interface will assume method names
584 are color names and return the hex value,
585
586 $obj->black eq $obj->hex("black")
587
588 Method names are case-insensitive, and underscores are ignored.
589
590 =head2 Utility Functions
591
592 These functions are not exported by default, so much be specified to
593 be used:
594
595 use Graphics::ColorNames qw( all_schemes hex2tuple tuple2hex );
596
597 =over
598
599 =item all_schemes
600
601 @schemes = all_schemes();
451 $hex = $pal->hex('blue', '#'); # returns "#0000ff"
452
453 If the color does not exist, it will return an empty string.
454
455 A hexidecimal RGB value in the form of C<#RRGGBB>, C<0xRRGGBB> or
456 C<RRGGBB> will return itself:
457
458 $color = $pal->hex('#123abc'); # returns '123abc'
459
460 =head2 autoloaded color name methods
461
462 Autoloaded color name methods were removed in v3.4.0.
463
464 =head2 C<load_scheme>
465
466 $pal->load_scheme( $scheme );
467
468 This dynamically loads a color scheme, which can be either a hash
469 reference or code reference.
470
471 =head1 EXPORTS
472
473 =head2 C<all_schemes>
474
475 my @schemes = all_schemes();
602476
603477 Returns a list of all available color schemes installed on the machine
604478 in the F<Graphics::ColorNames> namespace.
605479
606480 The order has no significance.
607481
608 =item hex2tuple
609
610 ($red, $green, $blue) = hex2tuple( $colors{'AliceBlue'});
611
612 =item tuple2hex
613
614 $rgb = tuple2hex( $red, $green, $blue );
615
616 =back
617
618 =head2 Color Schemes
619
620 The following schemes are available by default:
621
622 =over
623
624 =item X
625
626 About 750 color names used in X-Windows (although about 90+ of them are
627 duplicate names with spaces).
628
629 =item HTML
630
631 16 common color names defined in the HTML 4.0 specification. These
632 names are also used with older CSS and SVG specifications. (You may
633 want to see L<Graphics::ColorNames::SVG> for a complete list.)
634
635 =item Netscape
636
637 100 color names names associated Netscape 1.1 (I cannot determine whether
638 they were once usable in Netscape or were arbitrary names for RGB values--
639 many of these names are not recognized by later versions of Netscape).
640
641 This scheme may be deprecated in future versions, but available as a
642 separate module.
643
644 =item Windows
645
646 16 commom color names used with Microsoft Windows and related
647 products. These are actually the same colors as the L</HTML> scheme,
648 although with different names.
649
650 =back
651
652 Rather than a color scheme, the path or open filehandle for a
653 F<rgb.txt> file may be specified.
654
655 Additional color schemes may be available on CPAN.
656
657 =head2 Custom Color Schemes
482 =head2 C<hex2tuple>
483
484 Converts a hexidecimal string to a tuple.
485
486 =head2 C<tuple2hex>
487
488 Converts a tuple to a hexidecimal string.
489
490 =head1 TIED INTERFACE
491
492 The standard interface (prior to version 0.40) was through a tied hash:
493
494 tie %pal, 'Graphics::ColorNames', qw[ X WWW ];
495
496 This interface is deprecated, and will be moved to a separate module
497 in the future.
498
499 =head1 CUSTOM COLOR SCHEMES
658500
659501 You can add naming scheme files by creating a Perl module is the name
660502 C<Graphics::ColorNames::SCHEMENAME> which has a subroutine named
693535 version of L<Graphics::ColorNames> should be 2.10 in your requirements.)
694536
695537 An example of an additional module is the L<Graphics::ColorNames::Mozilla>
696 module by Steve Pomeroy.
538 module.
697539
698540 Since version 1.03, C<NamesRgbTable> may also return a code reference:
699541
702544 sub NamesRgbTable() {
703545 return sub {
704546 my $name = shift;
705 return 0xffa500;
547 return 0xffa500;
706548 };
707549 }
708550
709551 See L<Graphics::ColorNames::GrayScale> for an example.
710552
711 =head2 Graphics::ColourNames
712
713 The alias "Graphics::ColourNames" (British spelling) is no longer available
714 as of version 2.01.
715
716 It seems absurd to maintain it when all the modules does is provide an
717 alternative spelling for the module I<name> without doing anything about
718 the component colors of each scheme, and when most other modules
719 (and non-Perl software) does not bother with such things.
553 =head1 ROADMAP
554
555 The following changes are planned in the future:
556
557 =over 4
558
559 =item *
560
561 The tied interface will be removed, but implemented in a separate
562 module for users that wish to use it.
563
564 =item *
565
566 The namespace for color schemes will be moved to the
567 C<Graphics::ColorNames::Schemes> but options will be added to use the
568 existing scheme.
569
570 This will allow modules to be named like C<Graphics::ColorNames::Tied>
571 without being confused for color schemes.
572
573 =item *
574
575 This module will be rewritten to be a L<Moo>-based class.
576
577 =back
720578
721579 =head1 SEE ALSO
722580
730588 L<Graphics::ColorObject> can convert between RGB and other color space
731589 types.
732590
591 L<Graphics::ColorUtils> can also convert betweeb RGB and other color
592 space types, and supports RGB from names in various color schemes.
593
733594 L<Acme::AutoColor> provides subroutines corresponding to color names.
734595
735 =begin readme
736
737 =head1 REVISION HISTORY
738
739 Changes since the last release:
740
741 =for readme include file=Changes start=^2.11 stop=^2.04 type=text
742
743 More details can be found in the F<Changes> file.
744
745 =end readme
746
747 =for readme continue
596 =head1 SOURCE
597
598 The development version is on github at L<https://github.com/robrwo/Graphics-ColorNames>
599 and may be cloned from L<git://github.com/robrwo/Graphics-ColorNames.git>
600
601 The SourceForge project for this module at
602 L<http://sourceforge.net/projects/colornames/> is no longer
603 maintained.
604
605 =head1 BUGS
606
607 Please report any bugs or feature requests on the bugtracker website
608 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames> or
609 by email to
610 L<bug-Graphics-ColorNames@rt.cpan.org|mailto:bug-Graphics-ColorNames@rt.cpan.org>.
611
612 When submitting a bug or request, please include a test-file or a
613 patch to an existing test-file that illustrates the bug or desired
614 feature.
748615
749616 =head1 AUTHOR
750617
751 Robert Rothenberg <rrwo at cpan.org>
752
753 =for readme stop
754
755 =head2 Acknowledgements
756
757 Alan D. Salewski <alans at cji.com> for feedback and the addition of
758 C<tuple2hex>.
759
760 Steve Pomeroy <xavier at cpan.org>, "chemboy" <chemboy at perlmonk.org>
761 and "magnus" <magnus at mbox604.swipnet.se> who pointed out issues
762 with various color schemes.
763
764 =head2 Suggestions and Bug Reporting
765
766 Feedback is always welcome. Please use the CPAN Request Tracker at
767 L<http://rt.cpan.org> to submit bug reports.
768
769 There is a Sourceforge project for this package at
770 L<http://sourceforge.net/projects/colornames/>.
771
772 If you create additional color schemes, please make them available
773 separately in CPAN rather than submit them to me for inclusion into
774 this module.
775
776 =for readme continue
777
778 =head1 LICENSE
779
780 Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved.
781 This program is free software; you can redistribute it and/or
782 modify it under the same terms as Perl itself.
618 Robert Rothenberg <rrwo@cpan.org>
619
620 =head1 CONTRIBUTORS
621
622 =for stopwords Alan D. Salewski Steve Pomeroy "chemboy" Magnus Cedergren Gary Vollink Claus Färber Andreas J. König Slaven Rezić
623
624 =over 4
625
626 =item *
627
628 Alan D. Salewski <alans@cji.com>
629
630 =item *
631
632 Steve Pomeroy <xavier@cpan.org>
633
634 =item *
635
636 "chemboy" <chemboy@perlmonk.org>
637
638 =item *
639
640 Magnus Cedergren <magnus@mbox604.swipnet.se>
641
642 =item *
643
644 Gary Vollink <gary@vollink.com>
645
646 =item *
647
648 Claus Färber <cfaerber@cpan.org>
649
650 =item *
651
652 Andreas J. König <andk@cpan.org>
653
654 =item *
655
656 Slaven Rezić <slaven@rezic.de>
657
658 =back
659
660 =head1 COPYRIGHT AND LICENSE
661
662 This software is Copyright (c) 2001-2019 by Robert Rothenberg.
663
664 This is free software, licensed under:
665
666 The Artistic License 2.0 (GPL Compatible)
783667
784668 =cut
0 do { my $x = {
1 'configure' => {
2 'requires' => {
3 'ExtUtils::MakeMaker' => '0'
4 }
5 },
6 'develop' => {
7 'requires' => {
8 'Test::EOF' => '0',
9 'Test::EOL' => '0',
10 'Test::MinimumVersion' => '0',
11 'Test::More' => '0.88',
12 'Test::NoTabs' => '0',
13 'Test::Pod' => '1.41',
14 'Test::Pod::LinkCheck' => '0',
15 'Test::Portability::Files' => '0',
16 'Test::TrailingSpace' => '0.0203'
17 }
18 },
19 'runtime' => {
20 'requires' => {
21 'Exporter' => '5.57',
22 'Module::Load' => '0.10',
23 'Module::Loaded' => '0',
24 'perl' => 'v5.10.0',
25 'version' => '0'
26 }
27 },
28 'test' => {
29 'recommends' => {
30 'CPAN::Meta' => '2.120900'
31 },
32 'requires' => {
33 'File::Spec' => '0',
34 'FileHandle' => '0',
35 'IO::File' => '0',
36 'Module::Metadata' => '0',
37 'Test::Exception' => '0',
38 'Test::More' => '0',
39 'Test::Most' => '0',
40 'constant' => '0',
41 'lib' => '0',
42 'perl' => 'v5.10.0'
43 }
44 }
45 };
46 $x;
47 }
0 #!perl
1
2 use strict;
3 use warnings;
4
5 # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027
6
7 use Test::More tests => 1;
8
9 use Module::Metadata;
10 use File::Spec;
11
12 # from $version::LAX
13 my $lax_version_re =
14 qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
15 |
16 (?:\.[0-9]+) (?:_[0-9]+)?
17 ) | (?:
18 v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
19 |
20 (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
21 )
22 )/x;
23
24 # hide optional CPAN::Meta modules from prereq scanner
25 # and check if they are available
26 my $cpan_meta = "CPAN::Meta";
27 my $cpan_meta_pre = "CPAN::Meta::Prereqs";
28 my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
29
30 # Verify requirements?
31 my $DO_VERIFY_PREREQS = 1;
32
33 sub _max {
34 my $max = shift;
35 $max = ( $_ > $max ) ? $_ : $max for @_;
36 return $max;
37 }
38
39 sub _merge_prereqs {
40 my ($collector, $prereqs) = @_;
41
42 # CPAN::Meta::Prereqs object
43 if (ref $collector eq $cpan_meta_pre) {
44 return $collector->with_merged_prereqs(
45 CPAN::Meta::Prereqs->new( $prereqs )
46 );
47 }
48
49 # Raw hashrefs
50 for my $phase ( keys %$prereqs ) {
51 for my $type ( keys %{ $prereqs->{$phase} } ) {
52 for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
53 $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
54 }
55 }
56 }
57
58 return $collector;
59 }
60
61 my @include = qw(
62
63 );
64
65 my @exclude = qw(
66
67 );
68
69 # Add static prereqs to the included modules list
70 my $static_prereqs = do './t/00-report-prereqs.dd';
71
72 # Merge all prereqs (either with ::Prereqs or a hashref)
73 my $full_prereqs = _merge_prereqs(
74 ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
75 $static_prereqs
76 );
77
78 # Add dynamic prereqs to the included modules list (if we can)
79 my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
80 my $cpan_meta_error;
81 if ( $source && $HAS_CPAN_META
82 && (my $meta = eval { CPAN::Meta->load_file($source) } )
83 ) {
84 $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
85 }
86 else {
87 $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source)
88 $source = 'static metadata';
89 }
90
91 my @full_reports;
92 my @dep_errors;
93 my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
94
95 # Add static includes into a fake section
96 for my $mod (@include) {
97 $req_hash->{other}{modules}{$mod} = 0;
98 }
99
100 for my $phase ( qw(configure build test runtime develop other) ) {
101 next unless $req_hash->{$phase};
102 next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
103
104 for my $type ( qw(requires recommends suggests conflicts modules) ) {
105 next unless $req_hash->{$phase}{$type};
106
107 my $title = ucfirst($phase).' '.ucfirst($type);
108 my @reports = [qw/Module Want Have/];
109
110 for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
111 next if $mod eq 'perl';
112 next if grep { $_ eq $mod } @exclude;
113
114 my $file = $mod;
115 $file =~ s{::}{/}g;
116 $file .= ".pm";
117 my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
118
119 my $want = $req_hash->{$phase}{$type}{$mod};
120 $want = "undef" unless defined $want;
121 $want = "any" if !$want && $want == 0;
122
123 my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
124
125 if ($prefix) {
126 my $have = Module::Metadata->new_from_file( File::Spec->catfile($prefix, $file) )->version;
127 $have = "undef" unless defined $have;
128 push @reports, [$mod, $want, $have];
129
130 if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
131 if ( $have !~ /\A$lax_version_re\z/ ) {
132 push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
133 }
134 elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
135 push @dep_errors, "$mod version '$have' is not in required range '$want'";
136 }
137 }
138 }
139 else {
140 push @reports, [$mod, $want, "missing"];
141
142 if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
143 push @dep_errors, "$mod is not installed ($req_string)";
144 }
145 }
146 }
147
148 if ( @reports ) {
149 push @full_reports, "=== $title ===\n\n";
150
151 my $ml = _max( map { length $_->[0] } @reports );
152 my $wl = _max( map { length $_->[1] } @reports );
153 my $hl = _max( map { length $_->[2] } @reports );
154
155 if ($type eq 'modules') {
156 splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
157 push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
158 }
159 else {
160 splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
161 push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
162 }
163
164 push @full_reports, "\n";
165 }
166 }
167 }
168
169 if ( @full_reports ) {
170 diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
171 }
172
173 if ( $cpan_meta_error || @dep_errors ) {
174 diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n";
175 }
176
177 if ( $cpan_meta_error ) {
178 my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
179 diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n";
180 }
181
182 if ( @dep_errors ) {
183 diag join("\n",
184 "\nThe following REQUIRED prerequisites were not satisfied:\n",
185 @dep_errors,
186 "\n"
187 );
188 }
189
190 pass;
191
192 # vim: ts=4 sts=4 sw=4 et:
+0
-105
t/01-ColorNames.t less more
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More tests => 54;
5 use Test::Exception;
6
7 use_ok('Graphics::ColorNames', '2.10', qw( hex2tuple tuple2hex all_schemes ));
8
9 {
10 my %schemes = map { $_=>1, } all_schemes();
11 ok((keys %schemes) >= 4); # Windows, Netscape, HTML, and X
12 ok($schemes{X});
13 ok($schemes{HTML});
14 ok($schemes{Windows});
15 ok($schemes{Netscape});
16 }
17
18 tie my %colors, 'Graphics::ColorNames';
19 ok(tied %colors);
20
21 my $count = 0;
22 foreach my $name (keys %colors)
23 {
24 my @RGB = hex2tuple($colors{$name});
25 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
26 }
27 ok($count == keys %colors);
28
29 $count = 0;
30 foreach my $name (keys %colors)
31 {
32 $count++, if ($colors{lc($name)} eq $colors{uc($name)});
33 }
34 ok($count == keys %colors);
35
36
37 $count = 0;
38 foreach my $name (keys %colors)
39 {
40 $count++, if (exists($colors{$name}))
41 }
42 ok($count == keys %colors);
43
44 $count = 0;
45 foreach my $name (keys %colors)
46 {
47 my $rgb = $colors{$name};
48 $count++, if (defined $colors{$rgb});
49 $count++, if (defined $colors{"\x23".$rgb});
50 }
51 ok($count == (2*(keys %colors)));
52
53 # Test CLEAR, DELETE and STORE as returning errors
54
55 dies_ok { undef %colors } "undef %colors";
56
57 dies_ok { %colors = (); } "%colors = ()";
58
59 dies_ok { $colors{MyCustomColor} = 'FFFFFF'; } "STORE";
60
61 dies_ok { delete($colors{MyCustomColor}); } "DELETE";
62
63 # Test RGB values being passed through
64
65 foreach my $rgb (qw(
66 000000 000001 000010 000100 001000 010000 100000
67 111111 123abc abc123 123ABC ABC123 abcdef ABCDEF
68 )) {
69 ok($colors{ "\x23" . $rgb } eq lc($rgb));
70 ok($colors{ $rgb } eq lc($rgb));
71 }
72
73 # Test using multiple schemes, with issues in overlapping
74
75 tie my %colors2, 'Graphics::ColorNames', qw( X Netscape );
76
77 ok(!exists $colors{Silver}); # Silver doesn't exist in X
78 ok(defined $colors2{Silver}); # It does in Netscape
79
80 # Test precedence
81
82 ok($colors{DarkGreen} eq '006400'); # DarkGreen in X
83 ok($colors2{DarkGreen} eq '006400'); # DarkGreen in X
84 ok($colors2{DarkGreen} ne '2f4f2f'); # DarkGreen in Netscape
85
86 tie my %colors3, 'Graphics::ColorNames', qw( Netscape X );
87
88 ok($colors{Brown} eq 'a52a2a'); # Brown in X
89 ok($colors2{Brown} eq 'a52a2a'); # Brown in X (don't try Netscape)
90 ok($colors3{Brown} eq 'a62a2a'); # Brown in Netscape (don't try X)
91
92 # Test handling of non-existent color names
93
94 ok(!defined $colors{NonExistentColorName});
95 ok(!exists $colors{NonExistentColorName});
96
97 # Test dynamic loading of scheme
98
99 my $colorobj = tied(%colors);
100 $colorobj->load_scheme({ nonexistentcolorname => 0x123456 } );
101 ok($colors{NonExistentColorName} eq '123456');
102
103
104
0 #!/usr/bin/perl
1
2 use Test::Most;
3
4 use lib 't/lib';
5
6 use_ok( 'Graphics::ColorNames', qw/ all_schemes hex2tuple tuple2hex / );
7
8 ok my @schemes = all_schemes(), 'all_schemes';
9
10 cmp_deeply( \@schemes, supersetof(qw/ X Test /), 'minimum set of schemes' );
11
12 is_deeply [ hex2tuple('010203') ], [ 1, 2, 3 ], 'hex2tuple';
13
14 is_deeply [ hex2tuple('ffeedd') ], [ 255, 238, 221 ], 'hex2tuple';
15
16 is tuple2hex( 1, 2, 3 ) => '010203', 'tuple2hex';
17
18 is tuple2hex( 255, 238, 221 ) => 'ffeedd', 'tuple2hex';
19
20 done_testing;
+0
-13
t/01-version.t less more
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More tests => 5;
4
5 use_ok("Graphics::ColorNames");
6
7 my @Modules = (qw( X HTML Windows Netscape));
8
9 foreach my $mod (@Modules) {
10 use_ok("Graphics::ColorNames::$mod", $Graphics::ColorNames::VERSION);
11 }
12
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More tests => 19;
5
6 use_ok('Graphics::ColorNames', 2.1002, qw( hex2tuple tuple2hex ));
7
8 tie my %colors, 'Graphics::ColorNames', 'X';
9 ok(tied %colors);
10
11 ok(keys %colors == 665); #
12
13 my $count = 0;
14 foreach my $name (keys %colors)
15 {
16 my @RGB = hex2tuple( $colors{$name} );
17 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
18 }
19 ok($count == keys %colors);
20
21 foreach my $ad (qw( royal dodger slate sky steel )) {
22 foreach my $col (qw( blue )) {
23 ok(exists $colors{"$ad$col"});
24 ok($colors{"$ad$col"} eq $colors{"$ad $col"}, "$ad $col");
25 ok($colors{"$ad-$col"} eq $colors{"$ad $col"}, "$ad $col");
26 }
27 }
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More tests => 19;
5
6 use_ok( 'Graphics::ColorNames', 2.1002, qw( hex2tuple tuple2hex ) );
7
8 tie my %colors, 'Graphics::ColorNames', 'X';
9 ok( tied %colors );
10
11 is( scalar(keys %colors), 676 ); #
12
13 my $count = 0;
14 foreach my $name ( keys %colors ) {
15 my @RGB = hex2tuple( $colors{$name} );
16 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
17 }
18 ok( $count == keys %colors );
19
20 foreach my $ad (qw( royal dodger slate sky steel )) {
21 foreach my $col (qw( blue )) {
22 ok( exists $colors{"$ad$col"} );
23 ok( $colors{"$ad$col"} eq $colors{"$ad $col"}, "$ad $col" );
24 ok( $colors{"$ad-$col"} eq $colors{"$ad $col"}, "$ad $col" );
25 }
26 }
+0
-23
t/03-HTML.t less more
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More tests => 7;
4
5 use_ok('Graphics::ColorNames', 1.06, qw( hex2tuple tuple2hex ));
6
7 tie my %colors, 'Graphics::ColorNames', 'HTML';
8 ok(tied %colors);
9
10 ok(keys %colors == 17);
11
12 my $count = 0;
13 foreach my $name (keys %colors)
14 {
15 my @RGB = hex2tuple( $colors{$name} );
16 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
17 }
18 ok($count == keys %colors);
19
20 ok(exists($colors{"fuchsia"}));
21 ok(exists($colors{"fuscia"}));
22 ok($colors{"fuscia"} eq $colors{"fuchsia"});
0 #!/usr/bin/perl
1
2 use Test::Most;
3
4 use lib 't/lib';
5
6 use_ok('Graphics::ColorNames');
7
8 my $s = Graphics::ColorNames->new;
9 isa_ok $s, 'Graphics::ColorNames';
10
11 subtest 'hex' => sub {
12
13 is $s->hex('darkgreen'), '006400', 'darkgreen';
14 is $s->hex('Dark Green'), '006400', 'Dark Green';
15 is $s->hex('Dark-Green'), '006400', 'Dark-Green';
16 is $s->hex('Dark_Green'), '006400', 'Dark-Green';
17
18 is $s->hex( 'darkgreen', '#' ), '#006400', 'darkgreen (prefix)';
19 is $s->hex( 'darkgreen', '0x' ), '0x006400', 'darkgreen (prefix)';
20
21 is $s->hex('dorkreen'), '', 'nonexistenct color';
22 is $s->hex( 'dorkreen', '#' ), '', 'nonexistenct color with prefix';
23
24 is $s->hex('123abc') => '123abc', 'passthru';
25 is $s->hex('#123abc') => '123abc', 'passthru (# prefix)';
26 is $s->hex('0x123abc') => '123abc', 'passthru (0x prefix)';
27
28 };
29
30 subtest 'rgb' => sub {
31
32 is_deeply [ $s->rgb('darkgreen') ], [ 0, 0x64, 0 ], 'darkgreen';
33 is_deeply [ $s->rgb('DarkGreen') ], [ 0, 0x64, 0 ], 'DarkGreen';
34 is_deeply [ $s->rgb('Dark-Green') ], [ 0, 0x64, 0 ], 'Dark-Green';
35 is_deeply [ $s->rgb('Dark_Green') ], [ 0, 0x64, 0 ], 'Dark_Green';
36
37 is_deeply [ $s->rgb( 'darkgreen', ',' ) ], [ 0, 0x64, 0 ],
38 'darkgreen (separator ignored in list context)';
39
40 is $s->rgb('darkgreen'), "0,100,0", 'darkgreen (scalar)';
41 is $s->rgb( 'darkgreen', ' ' ), "0 100 0",
42 'darkgreen (scalar with separator)';
43
44 is_deeply [ $s->rgb('dorkreen') ], [], 'nonexistent color';
45 is $s->rgb('dorkreen'), '', 'nonexistent color (scalar context)';
46 is $s->rgb( 'dorkreen', ' ' ), '',
47 'nonexistent color (scalar context with separator)';
48
49 is_deeply [ $s->rgb('123abc') ] => [ 18, 58, 188 ],
50 'passthru (list context)';
51 is $s->rgb('123abc') => '18,58,188', 'passthru';
52 is $s->rgb( '123abc', ' ' ) => '18 58 188', 'passthru (with separator)';
53 is $s->rgb('#123abc') => '18,58,188', 'passthru (# prefix)';
54 is $s->rgb('0x123abc') => '18,58,188', 'passthru (0x prefix)';
55
56 };
57
58 subtest 'load_scheme' => sub {
59
60 is $s->hex('nonexistentcolorname') => '', 'unknown color';
61
62 ok $s->load_scheme( { nonexistentcolorname => 0x123456 } ), 'load_scheme';
63
64 is $s->hex('nonexistentcolorname') => '123456', 'loaded color';
65
66 };
67
68 subtest 'autoloading removed' => sub {
69
70 ok $s->rgb('darkgreen'), 'has darkgreen color';
71
72 ok !$s->can('darkgreen'), 'no darkgreen method';
73
74 };
75
76 done_testing;
+0
-20
t/04-Windows.t less more
0 #!/usr/buin/perl
1
2 use strict;
3
4 use Test::More tests => 4;
5
6 use_ok('Graphics::ColorNames', 1.06, qw( hex2tuple tuple2hex ));
7
8 tie my %colors, 'Graphics::ColorNames', 'Windows';
9 ok(tied %colors);
10
11 ok(keys %colors == 16);
12
13 my $count = 0;
14 foreach my $name (keys %colors)
15 {
16 my @RGB = hex2tuple( $colors{$name} );
17 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
18 }
19 ok($count == keys %colors);
0 #!/usr/bin/perl
1
2 use Test::Most;
3
4 use lib 't/lib';
5
6 use_ok( 'Graphics::ColorNames' );
7
8 my $sxw = Graphics::ColorNames->new( qw/ X Test / );
9 isa_ok $sxw, 'Graphics::ColorNames';
10
11 is $sxw->hex('darkgreen'), '006400', 'DarkGreen (X)';
12
13 my $swx = Graphics::ColorNames->new( qw/ Test X / );
14 isa_ok $swx, 'Graphics::ColorNames';
15
16 is $swx->hex('darkgreen'), '008000', 'DarkGreen (Test)';
17
18 done_testing;
+0
-32
t/05-Netscape.t less more
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More tests => 9;
5
6 use_ok('Graphics::ColorNames', 2.10, qw( hex2tuple tuple2hex ));
7
8 tie my %colors, 'Graphics::ColorNames', 'Netscape';
9 ok(tied %colors);
10
11 ok(keys %colors == 100); #
12
13 my $count = 0;
14 foreach my $name (keys %colors)
15 {
16 my @RGB = hex2tuple( $colors{$name} );
17 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
18 }
19 ok($count == keys %colors);
20
21 # Problem is with Netscape's color definitions
22
23 {
24 # local $TODO = "Problem with Netscape color definitions";
25 ok($colors{gold} ne $colors{mediumblue});
26 ok($colors{lightblue} ne $colors{mediumblue});
27 ok($colors{lightblue} ne $colors{gold});
28 }
29
30 ok($colors{"semisweetchocolate"} eq $colors{"semi-sweetchocolate"});
31 ok($colors{"baker\'schocolate"} eq $colors{"bakerschocolate"});
0 #!/usr/bin/perl
1
2 use Test::Most;
3
4 use lib 't/lib';
5
6 use_ok( 'Graphics::ColorNames', '3.3', qw( hex2tuple tuple2hex ) );
7
8 tie my %colors, 'Graphics::ColorNames';
9 ok( tied %colors );
10
11 my $count = 0;
12 foreach my $name ( keys %colors ) {
13 my @RGB = hex2tuple( $colors{$name} );
14 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
15 }
16 ok( $count == keys %colors );
17
18 $count = 0;
19 foreach my $name ( keys %colors ) {
20 $count++, if ( $colors{ lc($name) } eq $colors{ uc($name) } );
21 }
22 ok( $count == keys %colors );
23
24 $count = 0;
25 foreach my $name ( keys %colors ) {
26 $count++, if ( exists( $colors{$name} ) );
27 }
28 ok( $count == keys %colors );
29
30 $count = 0;
31 foreach my $name ( keys %colors ) {
32 my $rgb = $colors{$name};
33 $count++, if ( defined $colors{$rgb} );
34 $count++, if ( defined $colors{ "\x23" . $rgb } );
35 }
36 ok( $count == ( 2 * ( keys %colors ) ) );
37
38 # Test CLEAR, DELETE and STORE as returning errors
39
40 dies_ok { undef %colors } "undef %colors";
41
42 dies_ok { %colors = (); } "%colors = ()";
43
44 dies_ok { $colors{MyCustomColor} = 'FFFFFF'; } "STORE";
45
46 dies_ok { delete( $colors{MyCustomColor} ); } "DELETE";
47
48 # Test RGB values being passed through
49
50 foreach my $rgb (
51 qw(
52 000000 000001 000010 000100 001000 010000 100000
53 111111 123abc abc123 123ABC ABC123 abcdef ABCDEF
54 )
55 )
56 {
57 ok( $colors{ "\x23" . $rgb } eq lc($rgb) );
58 ok( $colors{ "0x" . $rgb } eq lc($rgb) );
59 ok( $colors{$rgb} eq lc($rgb) );
60 }
61
62 # Test using multiple schemes, with issues in overlapping
63
64 tie my %colors3, 'Graphics::ColorNames', qw( X Test );
65
66 tie my %colors4, 'Graphics::ColorNames', qw( Test X );
67
68 # Test precedence
69
70 ok( $colors{DarkGreen} eq '006400' ); # DarkGreen in X
71 ok( $colors3{DarkGreen} eq '006400' ); # DarkGreen in X
72 ok( $colors4{DarkGreen} eq '008000' ); # DarkGreen in Test
73
74 # Test handling of non-existent color names
75
76 ok( !defined $colors{NonExistentColorName} );
77 ok( !exists $colors{NonExistentColorName} );
78
79 done_testing;
+0
-72
t/06-obj.t less more
0 #!/usr/bin/perl
1
2 use strict;
3
4 use constant TEST_CASES => {
5 "black" => 0x000000,
6 "red" => 0xff0000,
7 "green" => 0x00ff00,
8 "blue" => 0x0000ff,
9 "white" => 0xffffff,
10 # some arbitrary colors added for testing the autoloaded color names
11 "lavenderblush" => 0xfff0f5,
12 "lavender_blush" => 0xfff0f5,
13 "LavenderBlush" => 0xfff0f5,
14 "LAVENDERBLUSH" => 0xfff0f5,
15 };
16
17 use Test::More;
18 use Test::Exception;
19
20 my $tests = TEST_CASES;
21
22 plan tests => 4 + (11 * (keys %$tests));
23
24 use_ok('Graphics::ColorNames', 2.1003, (qw(tuple2hex)));
25
26 my $rgb = Graphics::ColorNames->new(qw( X ));
27 ok(defined $rgb);
28 ok($rgb->isa('Graphics::ColorNames'));
29
30 {
31 # This causes errors
32
33 # local $TODO = "AutoLoading non-existent color method";
34 dies_ok {
35 $rgb->SomeNonExistentColor();
36 } "SomeNonExistentColor should have failed";
37
38 }
39
40 foreach my $name (keys %$tests) {
41
42 my $a = $rgb->hex($name, '0x');
43 ok( $a =~ /^0x[0-9a-f]{6}$/i );
44 ok( eval($a) == $tests->{$name}, "Testing color $name" );
45
46 my $b = $rgb->hex($name, '#');
47 ok( $b =~ /^\x23[0-9a-f]{6}$/i );
48
49 my $c = $rgb->hex($name, "");
50 ok( $c =~ /^[0-9a-f]{6}$/i );
51
52 $c = $rgb->hex($name);
53 ok( $c =~ /^[0-9a-f]{6}$/i );
54
55 ok($rgb->$name eq $c);
56 {
57 local $TODO = "Handle the can() method";
58 ok($rgb->can($name));
59 }
60
61 my $d = $rgb->rgb($name, ',');
62 ok( $d =~ /^\d{1,3}(\,\d{1,3}){2}$/ );
63
64 my @v = $rgb->rgb($name);
65 ok( @v == 3 );
66
67 ok( join(',', @v) eq $d );
68 ok( tuple2hex(@v) eq $c );
69
70 }
71
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More tests => 10;
5
6 use_ok('Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ));
7
8 tie my %colors, 'Graphics::ColorNames', './t/rgb.txt';
9 ok(tied %colors);
10
11 ok(keys %colors == 6); #
12
13 my $count = 0;
14 foreach my $name (keys %colors)
15 {
16 my @RGB = hex2tuple( $colors{$name} );
17 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
18 }
19 ok($count == keys %colors);
20
21 foreach my $name (qw( one two three four five six)) {
22 ok(exists $colors{$name});
23 }
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More;
5 use Test::Exception;
6
7 use File::Spec::Functions qw/ rel2abs /;
8
9 use_ok( 'Graphics::ColorNames', 3.2, qw( hex2tuple tuple2hex ) );
10
11 my $file = './t-etc/rgb.txt';
12
13 throws_ok {
14 tie my %colors, 'Graphics::ColorNames', $file;
15 } qr/Unknown color scheme/, 'relative pathnames rejected (TIE)';
16
17 throws_ok {
18 my $po = Graphics::ColorNames->new($file);
19 } qr/Unknown color scheme/, 'relative pathnames rejected (OO)';
20
21 tie my %colors, 'Graphics::ColorNames', rel2abs($file);
22 ok tied %colors, 'is tied';
23
24 is scalar(keys %colors), 6, 'expected number of colors';
25
26 my $count = 0;
27 foreach my $name ( keys %colors ) {
28 my @RGB = hex2tuple( $colors{$name} );
29 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
30 }
31 ok( $count == keys %colors );
32
33 foreach my $name (qw( one two three four five six)) {
34 ok( exists $colors{$name} );
35 }
36
37 done_testing;
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More tests => 28;
4
5 use FileHandle;
6 use IO::File;
7
8 use_ok('Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ));
9
10 {
11 my $fh = new IO::File;
12 open($fh, './t/rgb.txt');
13
14
15 tie my %colors, 'Graphics::ColorNames', $fh;
16 ok(tied %colors);
17
18 ok(keys %colors == 6); #
19
20 my $count = 0;
21 foreach my $name (keys %colors)
22 {
23 my @RGB = hex2tuple( $colors{$name} );
24 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
25 }
26 ok($count == keys %colors);
27
28 foreach my $name (qw( one two three four five six)) {
29 ok(exists $colors{$name});
30 }
31
32 close $fh;
33 }
34
35 {
36 my $fh = new FileHandle;
37 open($fh, './t/rgb.txt');
38
39 tie my %colors, 'Graphics::ColorNames', $fh;
40 ok(tied %colors);
41
42 ok(keys %colors == 6); #
43
44 my $count = 0;
45 foreach my $name (keys %colors)
46 {
47 my @RGB = hex2tuple( $colors{$name} );
48 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
49 }
50 ok($count == keys %colors);
51
52 foreach my $name (qw( one two three four five six)) {
53 ok(exists $colors{$name});
54 }
55
56 close $fh;
57 }
58
59 {
60 open(my $fh, './t/rgb.txt');
61
62 tie my %colors, 'Graphics::ColorNames', $fh;
63 ok(tied %colors);
64
65 ok(keys %colors == 6); #
66
67 my $count = 0;
68 foreach my $name (keys %colors)
69 {
70 my @RGB = hex2tuple( $colors{$name} );
71 $count++, if (tuple2hex(@RGB) eq $colors{$name} );
72 }
73 ok($count == keys %colors);
74
75 foreach my $name (qw( one two three four five six)) {
76 ok(exists $colors{$name});
77 }
78
79 close $fh;
80 }
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More tests => 28;
4
5 use FileHandle;
6 use IO::File;
7
8 use_ok( 'Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ) );
9
10 {
11 my $fh = new IO::File;
12 open( $fh, './t-etc/rgb.txt' );
13
14 tie my %colors, 'Graphics::ColorNames', $fh;
15 ok( tied %colors );
16
17 ok( keys %colors == 6 ); #
18
19 my $count = 0;
20 foreach my $name ( keys %colors ) {
21 my @RGB = hex2tuple( $colors{$name} );
22 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
23 }
24 ok( $count == keys %colors );
25
26 foreach my $name (qw( one two three four five six)) {
27 ok( exists $colors{$name} );
28 }
29
30 close $fh;
31 }
32
33 {
34 my $fh = new FileHandle;
35 open( $fh, './t-etc/rgb.txt' );
36
37 tie my %colors, 'Graphics::ColorNames', $fh;
38 ok( tied %colors );
39
40 ok( keys %colors == 6 ); #
41
42 my $count = 0;
43 foreach my $name ( keys %colors ) {
44 my @RGB = hex2tuple( $colors{$name} );
45 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
46 }
47 ok( $count == keys %colors );
48
49 foreach my $name (qw( one two three four five six)) {
50 ok( exists $colors{$name} );
51 }
52
53 close $fh;
54 }
55
56 {
57 open( my $fh, './t-etc/rgb.txt' );
58
59 tie my %colors, 'Graphics::ColorNames', $fh;
60 ok( tied %colors );
61
62 ok( keys %colors == 6 ); #
63
64 my $count = 0;
65 foreach my $name ( keys %colors ) {
66 my @RGB = hex2tuple( $colors{$name} );
67 $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
68 }
69 ok( $count == keys %colors );
70
71 foreach my $name (qw( one two three four five six)) {
72 ok( exists $colors{$name} );
73 }
74
75 close $fh;
76 }
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More;
4
5 eval "use Color::Library 0.02";
6
7 plan skip_all => "Color::Library 0.02 required" if $@;
8
9 use constant TEST_CASES => {
10 "croceus" => 0xf4c2c2,
11 "croceus28" => 0xf4c2c2,
12 "croceus53" => 0xd99058,
13 # "black" => 0x000000,
14 # "aqua" => 0x00ffff,
15 # "maroon" => 0x800000,
16 # "lime" => 0x00ff00,
17 };
18
19 my $tests = TEST_CASES;
20
21 plan tests => 3 + (keys %$tests);
22
23 use_ok("Graphics::ColorNames", "2.10002");
24
25 use_ok("Color::Library::Dictionary::NBS_ISCC::B");
26
27 {
28 my $obj = Graphics::ColorNames->new( 'Color::Library::Dictionary::NBS_ISCC::B' );
29 ok ($obj->isa("Graphics::ColorNames"));
30
31 foreach my $name (keys %$tests) {
32 ok($obj->hex($name) eq sprintf('%06x',$tests->{$name}),
33 "failed test for color $name");
34 }
35
36 }
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More;
4
5 eval "use Color::Library 0.02";
6
7 plan skip_all => "Color::Library 0.02 required" if $@;
8
9 use constant TEST_CASES => {
10 "croceus" => 0xf4c2c2,
11 "croceus28" => 0xf4c2c2,
12 "croceus53" => 0xd99058,
13
14 # "black" => 0x000000,
15 # "aqua" => 0x00ffff,
16 # "maroon" => 0x800000,
17 # "lime" => 0x00ff00,
18 };
19
20 my $tests = TEST_CASES;
21
22 plan tests => 3 + ( keys %$tests );
23
24 use_ok( "Graphics::ColorNames", "2.10002" );
25
26 use_ok("Color::Library::Dictionary::NBS_ISCC::B");
27
28 {
29 my $obj =
30 Graphics::ColorNames->new('Color::Library::Dictionary::NBS_ISCC::B');
31 ok( $obj->isa("Graphics::ColorNames") );
32
33 foreach my $name ( keys %$tests ) {
34 ok( $obj->hex($name) eq sprintf( '%06x', $tests->{$name} ),
35 "failed test for color $name" );
36 }
37
38 }
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More;
5
6 eval "use Tie::Sub";
7
8 plan skip_all => "Tie::Sub required" if $@;
9
10 plan tests => 4;
11
12 use_ok('Graphics::ColorNames', '2.10', qw( all_schemes ));
13
14 tie my %colors, 'Graphics::ColorNames';
15
16 # Test handling of non-existent color names
17
18 ok(!defined $colors{NonExistentColorName});
19 ok(!exists $colors{NonExistentColorName});
20
21 # Test dynamic loading of scheme
22
23 my $colorobj = tied(%colors);
24 $colorobj->load_scheme( sub {
25 return 0x123456;
26 }
27 );
28 ok($colors{NonExistentColorName} eq '123456');
29
30
31
0 #!/usr/bin/perl
1
2 use strict;
3
4 use Test::More;
5
6 eval "use Tie::Sub";
7
8 plan skip_all => "Tie::Sub required" if $@;
9
10 plan tests => 4;
11
12 use_ok( 'Graphics::ColorNames', '2.10', qw( all_schemes ) );
13
14 tie my %colors, 'Graphics::ColorNames';
15
16 # Test handling of non-existent color names
17
18 ok( !defined $colors{NonExistentColorName} );
19 ok( !exists $colors{NonExistentColorName} );
20
21 # Test dynamic loading of scheme
22
23 my $colorobj = tied(%colors);
24 $colorobj->load_scheme(
25 sub {
26 return 0x123456;
27 }
28 );
29 ok( $colors{NonExistentColorName} eq '123456' );
+0
-13
t/90-file-port.t less more
0 #!/usr/bin/perl
1
2 use Test::More;
3
4 plan skip_all => "Enable DEVEL_TESTS environent variable"
5 unless ($ENV{DEVEL_TESTS});
6
7 eval "use Test::Portability::Files";
8
9 plan skip_all => "Test::Portability::Files required for testing filenames portability" if $@;
10
11
12 run_tests();
+0
-17
t/90-pod-coverage.t less more
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More;
4
5 plan skip_all => "Enable DEVEL_TESTS environent variable"
6 unless ($ENV{DEVEL_TESTS});
7
8 if (eval "use Test::Pod::Coverage tests => 1") {
9 }
10 else {
11 plan skip_all => "Test::Pod::Coverage required" if $@;
12 }
13
14 pod_coverage_ok("Graphics::ColorNames");
15
16
+0
-15
t/90-pod.t less more
0 #!/usr/bin/perl
1
2 use strict;
3 use Test::More;
4
5 plan skip_all => "Enable DEVEL_TESTS environent variable"
6 unless ($ENV{DEVEL_TESTS});
7
8 eval "use Test::Pod 1.00";
9
10 plan skip_all => "Test::Pod 1.00 required" if $@;
11
12 my @poddirs = qw( blib );
13
14 all_pod_files_ok( all_pod_files( @poddirs ) );
0
1 BEGIN {
2 unless ($ENV{AUTHOR_TESTING}) {
3 print qq{1..0 # SKIP these tests are for testing by the author\n};
4 exit
5 }
6 }
7
8 use strict;
9 use warnings;
10 use Test::More;
11
12 # Generated by Dist::Zilla::Plugin::Test::EOF 0.0600
13 eval "use Test::EOF";
14 plan skip_all => 'Test::EOF required to test for correct end of file flag' if $@;
15
16 all_perl_files_ok({ minimum_newlines => 1, maximum_newlines => 4 });
17
18 done_testing();
0
1 BEGIN {
2 unless ($ENV{AUTHOR_TESTING}) {
3 print qq{1..0 # SKIP these tests are for testing by the author\n};
4 exit
5 }
6 }
7
8 use strict;
9 use warnings;
10
11 # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19
12
13 use Test::More 0.88;
14 use Test::EOL;
15
16 my @files = (
17 'lib/Graphics/ColorNames.pm',
18 'lib/Graphics/ColorNames/X.pm',
19 't/00-report-prereqs.dd',
20 't/00-report-prereqs.t',
21 't/01-exports.t',
22 't/02-X.t',
23 't/03-oo.t',
24 't/04-precedence.t',
25 't/05-tied.t',
26 't/07-file.t',
27 't/08-filehandle.t',
28 't/09-colorlibrary.t',
29 't/10-sub.t',
30 't/author-eof.t',
31 't/author-eol.t',
32 't/author-minimum-version.t',
33 't/author-no-tabs.t',
34 't/author-pod-linkcheck.t',
35 't/author-pod-syntax.t',
36 't/author-portability.t',
37 't/lib/Graphics/ColorNames/Test.pm',
38 't/release-check-manifest.t',
39 't/release-fixme.t',
40 't/release-trailing-space.t'
41 );
42
43 eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
44 done_testing;
0
1 BEGIN {
2 unless ($ENV{AUTHOR_TESTING}) {
3 print qq{1..0 # SKIP these tests are for testing by the author\n};
4 exit
5 }
6 }
7
8 use strict;
9 use warnings;
10
11 use Test::More;
12 use Test::MinimumVersion;
13 all_minimum_version_from_metayml_ok();
0
1 BEGIN {
2 unless ($ENV{AUTHOR_TESTING}) {
3 print qq{1..0 # SKIP these tests are for testing by the author\n};
4 exit
5 }
6 }
7
8 use strict;
9 use warnings;
10
11 # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15
12
13 use Test::More 0.88;
14 use Test::NoTabs;
15
16 my @files = (
17 'lib/Graphics/ColorNames.pm',
18 'lib/Graphics/ColorNames/X.pm',
19 't/00-report-prereqs.dd',
20 't/00-report-prereqs.t',
21 't/01-exports.t',
22 't/02-X.t',
23 't/03-oo.t',
24 't/04-precedence.t',
25 't/05-tied.t',
26 't/07-file.t',
27 't/08-filehandle.t',
28 't/09-colorlibrary.t',
29 't/10-sub.t',
30 't/author-eof.t',
31 't/author-eol.t',
32 't/author-minimum-version.t',
33 't/author-no-tabs.t',
34 't/author-pod-linkcheck.t',
35 't/author-pod-syntax.t',
36 't/author-portability.t',
37 't/lib/Graphics/ColorNames/Test.pm',
38 't/release-check-manifest.t',
39 't/release-fixme.t',
40 't/release-trailing-space.t'
41 );
42
43 notabs_ok($_) foreach @files;
44 done_testing;
0 #!perl
1
2 BEGIN {
3 unless ($ENV{AUTHOR_TESTING}) {
4 print qq{1..0 # SKIP these tests are for testing by the author\n};
5 exit
6 }
7 }
8
9
10 use strict;
11 use warnings;
12 use Test::More;
13
14 foreach my $env_skip ( qw(
15 SKIP_POD_LINKCHECK
16 ) ){
17 plan skip_all => "\$ENV{$env_skip} is set, skipping"
18 if $ENV{$env_skip};
19 }
20
21 eval "use Test::Pod::LinkCheck";
22 if ( $@ ) {
23 plan skip_all => 'Test::Pod::LinkCheck required for testing POD';
24 }
25 else {
26 Test::Pod::LinkCheck->new->all_pod_ok;
27 }
0 #!perl
1
2 BEGIN {
3 unless ($ENV{AUTHOR_TESTING}) {
4 print qq{1..0 # SKIP these tests are for testing by the author\n};
5 exit
6 }
7 }
8
9 # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
10 use strict; use warnings;
11 use Test::More;
12 use Test::Pod 1.41;
13
14 all_pod_files_ok();
0
1 BEGIN {
2 unless ($ENV{AUTHOR_TESTING}) {
3 print qq{1..0 # SKIP these tests are for testing by the author\n};
4 exit
5 }
6 }
7
8 use strict;
9 use warnings;
10
11 use Test::More;
12
13 eval 'use Test::Portability::Files';
14 plan skip_all => 'Test::Portability::Files required for testing portability'
15 if $@;
16
17 run_tests();
0 package Graphics::ColorNames::Test;
1
2 use v5.6;
3
4 use strict;
5 use warnings;
6
7 sub NamesRgbTable() {
8 use integer;
9 return {
10 'black' => 0x000000,
11 'blue' => 0x0000ff,
12 'cyan' => 0x00ffff,
13 'green' => 0x00ff00,
14 'magenta' => 0xff00ff,
15 'red' => 0xff0000,
16 'yellow' => 0xffff00,
17 'white' => 0xffffff,
18 'darkblue' => 0x000080,
19 'darkcyan' => 0x008080,
20 'darkgreen' => 0x008000,
21 'darkmagenta' => 0x800080,
22 'darkred' => 0x800000,
23 'darkyellow' => 0x808000,
24 'darkgray' => 0x808080,
25 'lightgray' => 0xc0c0c0,
26 };
27 }
28
29 1;
30
31 __END__
0 #!perl -T
1
2 BEGIN {
3 unless ($ENV{RELEASE_TESTING}) {
4 print qq{1..0 # SKIP these tests are for release candidate testing\n};
5 exit
6 }
7 }
8
9
10 BEGIN {
11 unless ($ENV{RELEASE_TESTING}) {
12 require Test::More;
13 Test::More::plan(skip_all => 'these tests are for release candidate testing');
14 }
15 }
16
17 use Test::More;
18
19 eval "use Test::CheckManifest 1.24";
20 plan skip_all => "Test::CheckManifest 1.24 required for testing MANIFEST"
21 if $@;
22
23 ok_manifest();
0 #!perl
1
2 BEGIN {
3 unless ($ENV{RELEASE_TESTING}) {
4 print qq{1..0 # SKIP these tests are for release candidate testing\n};
5 exit
6 }
7 }
8
9
10 # This test is generated by Dist::Zilla::Plugin::Test::Fixme
11 use strict;
12 use warnings;
13
14 use Test::Fixme;
15 run_tests();
0 #!perl
1
2 BEGIN {
3 unless ($ENV{RELEASE_TESTING}) {
4 print qq{1..0 # SKIP these tests are for release candidate testing\n};
5 exit
6 }
7 }
8
9
10 use strict;
11 use warnings;
12
13 use Test::More;
14
15 eval "use Test::TrailingSpace";
16 if ($@)
17 {
18 plan skip_all => "Test::TrailingSpace required for trailing space test.";
19 }
20 else
21 {
22 plan tests => 1;
23 }
24
25 # TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly
26 # some other stuff.
27 my $finder = Test::TrailingSpace->new(
28 {
29 root => '.',
30 filename_regex => qr#\.(?:p[lm]|pod)\z#,
31 },
32 );
33
34 # TEST
35 $finder->no_trailing_space(
36 "No trailing space was found."
37 );
+0
-10
t/rgb.txt less more
0 # based on $Xorg: rgb.txt,v 1.3 2000/08/17
1 ! another comment
2 255 250 250 one
3 248 248 255 two
4 248 248 255 three
5 245 245 245 four
6 ! trailing spaces
7 245 245 245 five
8 ! spaces instead of tabs:
9 220 220 220 six
0 # based on $Xorg: rgb.txt,v 1.3 2000/08/17
1 ! another comment
2 255 250 250 one
3 248 248 255 two
4 248 248 255 three
5 245 245 245 four
6 ! trailing spaces
7 245 245 245 five
8 ! spaces instead of tabs:
9 220 220 220 six
0 [@CorePrep]
1
2 [-SingleEncoding]
3
4 ;; [-Transformer]
5 ;; transformer = List
6
7 [Name]
8 [Version]
9
10 [Region / prelude]
11
12 [Generic / SYNOPSIS]
13 [Generic / DESCRIPTION]
14
15 [Collect / METHODS]
16 command = method
17
18 [Collect / EXPORTS]
19 command = export
20
21 [Leftovers]
22
23 [Region / postlude]
24
25 [SourceGitHub]
26 [Bugs]
27
28 [Authors]
29
30 [Contributors]
31
32 [Legal]
33
34 [-AppendPrepend]