diff options
56 files changed, 3776 insertions, 2487 deletions
diff --git a/Build.PL b/Build.PL deleted file mode 100755 index 3b1169f..0000000 --- a/Build.PL +++ /dev/null @@ -1,41 +0,0 @@ -use Module::Build; - -my $build = Module::Build->new - ( - module_name => 'Graphics::ColorNames', - license => 'perl', - requires => { - 'perl' => '5.006', - 'base' => 0, -# 'AutoLoader' => 0, - 'Carp' => 0, - 'DirHandle' => 0, - 'Exporter' => 0, - 'File::Spec' => 0, - 'IO::File' => 0, - 'Module::Load' => '0.10', - 'Module::Loaded' => 0, - }, - recommends => { - 'Color::Library' => 0.02, - 'Tie::Sub' => 0, - 'Test::Pod::Coverage' => 0, - 'Test::Pod' => 1.00, - 'Test::Portability::Files' => 0, - 'Pod::Readme' => 0.09, - }, - build_requires => { - 'FileHandle' => 0, # for testing - 'Test::Exception' => 0, - 'Test::More' => 0, - }, -# autosplit => [ -# 'lib/Graphics/ColorNames.pm', -# ], - create_readme => ($Module::Build::VERSION >= 0.2702), - create_makefile_pl => 'traditional', - dist_author => 'Robert Rothenberg <rrwo at cpan.org>', - sign => 0, -); - -$build->create_build_script; @@ -1,208 +1,357 @@ -Revision history for Perl extension Graphics::ColorNames (with significant -updates noted by asterisks, '*'): - -2.11 Thu Jan 10 2008 - - updated version number for release - - minor changes of text format - - added fix for problems with Graphics::ColorNames::GrayScale - -2.10_05 Tue Jan 8 2008 - * checks if modules already loaded before re-loading them - (uses Module::Loaded for this) - - requires changed to load for dynamically loaded modules - - updated README - -2.10_04 Sun Jan 6 2008 - - reverted back to standard object-oriented style - - Tie::Sub is only loaded when a subroutine is used for scheme - -2.10_03 Sat Jan 5 2008 - - tests use Test::Exception to catch errors - - rewrite parts of documentation to emphasize object-oriented - interface rather than the tied interface - - implemented a proper DESTROY method - - misc code cleanup and reorganization - -2.10_02 Fri Jan 4 2008 - * added support for Color::Library dictionaries - - minor changes to error messages - - underscores in color names ignored - - auto-loading color names in object-oriented interface, e.g. - $obj->black() - - stubs for DESTROY and UNTIE methods - - 06-obj.t test more flexible - - pointless 01-ColourNames test removed - - more updates to documentation - -2.10_01 Thu Dec 20 2007 - * non-word characters (spaces, punctuation) now ignored in - color names - * smarter handling of comments in rgb.txt files - * significant rewrite to parts of the code, requires Tie::Sub - * rewritten how FIRSTKEY and NEXTKEY methods work - - better error handling - - minor updates to documentation - - typos in comments - - added better checking for minimum Perl version reqs - - added aliaes w/out punctuation in Netscape scheme - -2.04 Mon Dec 17 2007 - - fixed inconsistencies in Netscape color scheme - -2.03 Mon Dec 17 2007 - - fixed glitch with version test - - cleaned up format of text files - - removed unneeded dependency +Revision history for Graphics-ColorNames: -2.02 Sun Dec 16 2007 - - renamed developer-related test scripts - - removed 90-prereqs.t (it wasn't working properly sometimes) - - added DEVEL_TESTS environment variable as requirement for - developer tests - - README generated from POD using Pod::Readme - -2.01 Sun Dec 16 2007 - - Changed versions of specific color schemes to match main module - * Removed Graphics::ColourNames from the distribution - - updated documentation for Netscape.pm - -2.0_04 Tue Oct 24 2006 - - fixed Pod::Coverage tests (RT#20923) - - various optimizations - - changed to use inside-out object scheme - - no longer signing code (too many problems w/Module::Signature) - -2.0_03 Fri Apr 8 2005 - - fixed bug with reading scheme from FileHandle type - - fixed glitch in pod-coverage test - - corrected version in Graphics::ColourNames - - added tests to check versions in sync - -2.0_02 Thu Apr 7 2005 - - lesser-used routines made into autoloaded methods - - added Test::Portabiity::Files test - - minor updates for Netscape theme - - added support for :utility export tag - - added support for :all export tag - -2.0_01 Mon Apr 4 2005 - - removed DSLIP information from POD, since it has little meaning - - tweaked code - - color scheme can be a module name - - fixed bug in Pod::Coverage test, uses Test::Pod::Coverage - * major change in how schemes are stored, which affects priority - when CODE scheme types are used - - can load rgb.txt from GLOB, FileHandle or IO::File - - references can be specified as possible schemes in constructor - - added public load_scheme method - - various optimizations and tweaks - - IO::File is loaded only as needed - - rgb.txt file must be radable to be loaded - - tweaked tests - - RGB passthrough now consistently returns lowercase values - - minor optimization in FETCH for RGB passthrough - - added all_schemes function to query schemes - -1.06 Tue Mar 29 2005 - - cleaned up tests - - added DSLIP information to POD - - added Test::Pod tests - - added Pod::Coverage tests - - minor documentation changes - - uses Test::Prereq to test distro prereqs - - added SIGNATURE to distribution +v3.5.0 2019-06-06 21:28:32+01:00 Europe/London + [Incompatabilities] + - Bumped minimum prerequisite to Perl v5.10. -1.05 Fri Sep 3 2004 - - correction to Graphics::ColourNames - - correction to README + [Documentation] + - Corrected typo. -1.04 Fri Sep 3 2004 - - updates to POD - - a filehandle for a rgb.txt file can be specified + - Updated copyright year. -1.03 Thu Aug 26 2004 - - hooks to support CODE scheme types (as with module - Graphics::ColorNames::GrayScale 2.00) - - ColourNames.pm has same version of ColorNames.pm +v3.4.0 2018-11-18 19:12:44+00:00 Europe/London + [Incompatabilities] + - Autoloaded color name methods were removed. -1.02 Tue Aug 24 2004 - - added Graphics::ColourNames alias - - minor changes to ColorNames.pm - -1.01 Wed Aug 18 2004 - - corrected typo in REQUIREMENTS (wrong Perl version) - - uses Module::Load for improved dynamic loading - - EXISTS works across multiple color schemes - - bug in FETCH that returned key has been fixed - -1.00 Sat Jul 31 2004 - - changed version to 1.00 as release appears to be stable - - corrected bad link in POD - -0.39_04 Mon Jul 26 2004 - - rebuilt distribution with proper META.yml - -0.39_03 22 Jul 2004 - - added required rgb.txt for tests to MANIFEST and distro - -0.39_02 22 Jul 2004 - * now requires Perl 5.6.0 - - uses IO::File - - option to parse an rgb.txt file - - removed TODO from distribution - - Netscape.pm, HTML.pm and Windows.pm warnings enabled - - additions and corrections in POD - -0.39_01 21 Jul 2004 - - added Build.PL to distribution - - added hex() and rgb() methods - - created object-oriented interface - - additions and corrections in POD - -0.32 5 Dec 2002 - - fixed inconsistencies with grey/gray spellings in X.pm - - added note in POD about using rt.cpan.org for bug reports - - minor changes in POD for Netscape.pm - - added TODO file +v3.3.4 2018-11-11 15:12:53+00:00 Europe/London + [Documentation] + - Added a ROADMAP section for planned changes. + + [Toolchain] + - Tweaks to dist.ini. + +v3.3.3 2018-10-27 19:31:14+01:00 Europe/London + [Documentation] + - Fix typo in GCN::X POD. + +v3.3.2 2018-10-27 17:32:56+01:00 Europe/London + [Bug Fixes] + - Fix VERSION class method, RT 127301. + + [Toolchain] + - Tweaks to dist.ini for simplifying build. + +v3.3.1 2018-10-24 16:03:19+01:00 Europe/London + [Tests] + - Fixed text dependencies on modules that have been moved to + separate distributions, RT 127430. + +v3.3.0 2018-10-23 21:29:56+01:00 Europe/London + [Incompatabilities] + - The GCN::HTML and GCN::Windows schemes have been removed and + released as separate modules. + + - The prefix is now ignored for hex method for invalid color names. + + [Bug Fixes] + - Removed undef warning for unknown color names in hex and rgb methods. + + [Documentation] + - Reorganized the documentation. + + - Documented handling of unknown color names in hex and rgb methods. + + - Added INSTALL file to the distribution. + + [Tests] + - Reorganized and improved tests. + + [Other] + - The tied and autoloading interfaces are deprecated. + + - Added contributor to module metadata. + +v3.2.1 2018-10-06 10:59:36+01:00 Europe/London + [Bug Fixes] + - Fix VERSION, RT 127301. + +v3.2.0 2018-10-04 00:35:01+01:00 Europe/London + [Bug Fixes] + - Pass through RGB hexidecimals prefixed by "0x", as claimed + by the documentation. + + - Fix ambiguity between modiles and filenames, RT 54500. + + - Schema modules can be in any namespace. + + [Enhancements] + - GCN::X color scheme updated to 2014-07-06 version. + + [Incompatabilities] + - Filenames must now be absolute. + + [Tests] + - Minor improvement in style of some tests. + +v3.1.2 2018-10-01 23:14:34+01:00 Europe/London + [Tests] + - Removed dependency on GCN::Netscape, RT 127258. + +v3.1.1 2018-10-01 17:49:09+01:00 Europe/London + [Documentation] + - Added note that the HTML color scheme is deprecated. + + [Bug Fixes] + - Regexes test for ASCII digits only. + +v3.1.0 2018-09-30 13:37:11+01:00 Europe/London + [Incompatabilities] + - The Netscape color scheme has been split out into a separate + release. -0.31 23 Oct 2002 - - fixed mispelling of "fuchsia" in HTML.pm + [Documentation] + - Use modern syntax in some of the examples. -0.30 4 Oct 2001 - - fixed bug with non-existent color names - - corrected some typos in and updated the documentation - - added multiple color naming schemes - - when passed a value in the form of '#000000', returns that value + - Updated contributor names. -0.24 28 Apr 2001 - - fixed colors in X.pm (such as some 'green') defined as 0x000000 - - removed duplicate grays (ie, 'gray0') from X.pm - - renamed test suite files to enforce testing order - - v0.23 mistakenly dated 17 Mar instead of 17 April +v3.0.2 2018-09-28 17:54:49+01:00 Europe/London -0.23 17 Apr 2001 - - X-Windows color names now from rgb.txt (includes names with - spaces, such as 'alice blue' as well as 'aliceblue') - - Added Netscape color naming scheme + [Documentation] + - Identify how to report bugs. -0.22 15 Mar 2001 - - added example on how to add your own naming schema - - schema files (X.pm, HTML.pm, Windows.pm) were stored in the - wrong subdirectories - - removed test.pl and double-testing + - Add note about the old SourceForge project for this module. -0.21 12 Mar 2001 - - fixed an issue with Test::Harness expecting t/*.t tests + - Fixed abstract for Netscape module. -0.20 11 Mar 2001 - - no longer a Tie::Hash - - additional example in POD - - added Test::Harness and a better test suite - - commented-out 'use warnings' in modules - - addition of tuple2hex function - - changed the way files are included in the distribution + [Other] + - Tagged release with the RT bug database. -0.10 19 Feb 2001 - - original (experimental) version released + - Removed Windows line endings. +v3.0.1 2018-09-28 13:39:19+01:00 Europe/London + [Documentation] + - Added omitted Changes to v3.0.0. + + [Tests] + - Removed unnecessary version tests. + + [Toolchain] + - Use newer style of module exports. + + [Other] + - Perltidied source. + +v3.0.0 2018-09-28 00:00:12+01:00 Europe/London + [Documentation] + - Reformated Changes file. + + - POD is built using Pod::Weaver. + + - Removed outdated sections from POD. + + - Added additional module(s) to SEE ALSO section. + + [Tests] + - Removed QA tests that are handled by Dist::Zilla. + + [Toolchain] + - Use Dist::Zilla to build distribution. + + [Other Changes] + - Corrected typo in comment. + + - Cleaned up whitespace in the source code. + +2.11 2008-01-10 + - updated version number for release + - minor changes of text format + - added fix for problems with Graphics::ColorNames::GrayScale + +2.10_05 2008-01-08 + - checks if modules already loaded before re-loading them + (uses Module::Loaded for this) + - requires changed to load for dynamically loaded modules + - updated README + +2.10_04 2008-01-06 + - reverted back to standard object-oriented style + - Tie::Sub is only loaded when a subroutine is used for scheme + +2.10_03 2008-01-05 + - tests use Test::Exception to catch errors + - rewrite parts of documentation to emphasize object-oriented + interface rather than the tied interface + - implemented a proper DESTROY method + - misc code cleanup and reorganization + +2.10_02 2008-01-04 + - added support for Color::Library dictionaries + - minor changes to error messages + - underscores in color names ignored + - auto-loading color names in object-oriented interface, e.g. + $obj->black() + - stubs for DESTROY and UNTIE methods + - 06-obj.t test more flexible + - pointless 01-ColourNames test removed + - more updates to documentation + +2.10_01 2007-12-20 + - non-word characters (spaces, punctuation) now ignored in + color names + - smarter handling of comments in rgb.txt files + - significant rewrite to parts of the code, requires Tie::Sub + - rewritten how FIRSTKEY and NEXTKEY methods work + - better error handling + - minor updates to documentation + - typos in comments + - added better checking for minimum Perl version reqs + - added aliaes w/out punctuation in Netscape scheme + +2.04 2007-12-17 + - fixed inconsistencies in Netscape color scheme + +2.03 2007-12-17 + - fixed glitch with version test + - cleaned up format of text files + - removed unneeded dependency + +2.02 Sun Dec 16 2007 + - renamed developer-related test scripts + - removed 90-prereqs.t (it wasn't working properly sometimes) + - added DEVEL_TESTS environment variable as requirement for + developer tests + - README generated from POD using Pod::Readme + +2.01 2007-12-16 + - Changed versions of specific color schemes to match main module + - Removed Graphics::ColourNames from the distribution + - updated documentation for Netscape.pm + +2.0_04 2006-10-24 + - fixed Pod::Coverage tests (RT#20923) + - various optimizations + - changed to use inside-out object scheme + - no longer signing code (too many problems w/Module::Signature) + +2.0_03 2005-04-08 + - fixed bug with reading scheme from FileHandle type + - fixed glitch in pod-coverage test + - corrected version in Graphics::ColourNames + - added tests to check versions in sync + +2.0_02 2005-04-07 + - lesser-used routines made into autoloaded methods + - added Test::Portabiity::Files test + - minor updates for Netscape theme + - added support for :utility export tag + - added support for :all export tag + +2.0_01 2005-04-04 + - removed DSLIP information from POD, since it has little meaning + - tweaked code + - color scheme can be a module name + - fixed bug in Pod::Coverage test, uses Test::Pod::Coverage + - major change in how schemes are stored, which affects priority + when CODE scheme types are used + - can load rgb.txt from GLOB, FileHandle or IO::File + - references can be specified as possible schemes in constructor + - added public load_scheme method + - various optimizations and tweaks + - IO::File is loaded only as needed + - rgb.txt file must be radable to be loaded + - tweaked tests + - RGB passthrough now consistently returns lowercase values + - minor optimization in FETCH for RGB passthrough + - added all_schemes function to query schemes + +1.06 2005-03-29 + - cleaned up tests + - added DSLIP information to POD + - added Test::Pod tests + - added Pod::Coverage tests + - minor documentation changes + - uses Test::Prereq to test distro prereqs + - added SIGNATURE to distribution + +1.05 2004-09-04 + - correction to Graphics::ColourNames + - correction to README + +1.04 2004-09-03 + - updates to POD + - a filehandle for a rgb.txt file can be specified + +1.03 2004-08-26 + - hooks to support CODE scheme types (as with module + Graphics::ColorNames::GrayScale 2.00) + - ColourNames.pm has same version of ColorNames.pm + +1.02 2004-08-24 + - added Graphics::ColourNames alias + - minor changes to ColorNames.pm + +1.01 2004-08-18 + - corrected typo in REQUIREMENTS (wrong Perl version) + - uses Module::Load for improved dynamic loading + - EXISTS works across multiple color schemes + - bug in FETCH that returned key has been fixed + +1.00 2004-07-31 + - changed version to 1.00 as release appears to be stable + - corrected bad link in POD + +0.39_04 2004-07-26 + - rebuilt distribution with proper META.yml + +0.39_03 2004-07-22 + - added required rgb.txt for tests to MANIFEST and distro + +0.39_02 2004-07-22 + - now requires Perl 5.6.0 + - uses IO::File + - option to parse an rgb.txt file + - removed TODO from distribution + - Netscape.pm, HTML.pm and Windows.pm warnings enabled + - additions and corrections in POD + +0.39_01 2004-07-21 + - added Build.PL to distribution + - added hex() and rgb() methods + - created object-oriented interface + - additions and corrections in POD + +0.32 2002-12-05 + - fixed inconsistencies with grey/gray spellings in X.pm + - added note in POD about using rt.cpan.org for bug reports + - minor changes in POD for Netscape.pm + - added TODO file +0.31 2002-10-23 + - fixed mispelling of "fuchsia" in HTML.pm + +0.30 2001-10-04 + - fixed bug with non-existent color names + - corrected some typos in and updated the documentation + - added multiple color naming schemes + - when passed a value in the form of '#000000', returns that value + +0.24 2001-04-28 + - fixed colors in X.pm (such as some 'green') defined as 0x000000 + - removed duplicate grays (ie, 'gray0') from X.pm + - renamed test suite files to enforce testing order + - v0.23 mistakenly dated 17 Mar instead of 17 April + +0.23 2001-04-17 + - X-Windows color names now from rgb.txt (includes names with + spaces, such as 'alice blue' as well as 'aliceblue') + - Added Netscape color naming scheme + +0.22 2001-03-15 + - added example on how to add your own naming schema + - schema files (X.pm, HTML.pm, Windows.pm) were stored in the + wrong subdirectories + - removed test.pl and double-testing + +0.21 2001-03-12 + - fixed an issue with Test::Harness expecting t/*.t tests + +0.20 2001-03-11 + - no longer a Tie::Hash + - additional example in POD + - added Test::Harness and a better test suite + - commented-out 'use warnings' in modules + - addition of tuple2hex function + - changed the way files are included in the distribution + +0.10 2001-02-19 + - original (experimental) version released @@ -0,0 +1,72 @@ +This is the Perl distribution Graphics-ColorNames. + +Installing Graphics-ColorNames is straightforward. + +## Installation with cpanm + +If you have cpanm, you only need one line: + + % cpanm Graphics::ColorNames + +If it does not have permission to install modules to the current perl, cpanm +will automatically set up and install to a local::lib in your home directory. +See the local::lib documentation (https://metacpan.org/pod/local::lib) for +details on enabling it in your environment. + +## Installing with the CPAN shell + +Alternatively, if your CPAN shell is set up, you should just be able to do: + + % cpan Graphics::ColorNames + +## Manual installation + +As a last resort, you can manually install it. Download the tarball, untar it, +install configure prerequisites (see below), then build it: + + % perl Makefile.PL + % make && make test + +Then install it: + + % make install + +On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. + +If your perl is system-managed, you can create a local::lib in your home +directory to install modules to. For details, see the local::lib documentation: +https://metacpan.org/pod/local::lib + +The prerequisites of this distribution will also have to be installed manually. The +prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated +by running the manual build process described above. + +## Configure Prerequisites + +This distribution requires other modules to be installed before this +distribution's installer can be run. They can be found under the +"configure_requires" key of META.yml or the +"{prereqs}{configure}{requires}" key of META.json. + +## Other Prerequisites + +This distribution may require additional modules to be installed after running +Makefile.PL. +Look for prerequisites in the following phases: + +* to run make, PHASE = build +* to use the module code itself, PHASE = runtime +* to run tests, PHASE = test + +They can all be found in the "PHASE_requires" key of MYMETA.yml or the +"{prereqs}{PHASE}{requires}" key of MYMETA.json. + +## Documentation + +Graphics-ColorNames documentation is available as POD. +You can run `perldoc` from a shell to read the documentation: + + % perldoc Graphics::ColorNames + +For more information on installing Perl modules via CPAN, please see: +https://www.cpan.org/modules/INSTALL.html @@ -0,0 +1,207 @@ +This software is Copyright (c) 2001-2019 by Robert Rothenberg. + +This is free software, licensed under: + + The Artistic License 2.0 (GPL Compatible) + + The Artistic License 2.0 + + Copyright (c) 2000-2006, The Perl Foundation. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. +The intent is that the Copyright Holder maintains some artistic +control over the development of that Package while still keeping the +Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that +you do not Distribute the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the +Standard Version of this Package in any medium without restriction, +either gratis or for a Distributor Fee, provided that you duplicate +all of the original copyright notices and associated disclaimers. At +your discretion, such verbatim copies may or may not include a +Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such +will be subject to the Original License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + +Distribution of Compiled Forms of the Standard Version +or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be +valid at the time of your distribution. If these instructions, at any +time while you are carrying out such distribution, become invalid, you +must provide new instructions on demand or cease further distribution. +If you provide valid instructions or cease distribution within thirty +days after you become aware that the instructions are invalid, then +you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without +the Source, provided that you comply with Section 4 with respect to +the Source of the Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with +other works, to embed the Package in a larger work of your own, or to +build stand-alone binary or bytecode versions of applications that +include the Package, and Distribute the result without restriction, +provided the result does not expose a direct interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the +terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or +Modified Versions is governed by this Artistic License. By using, +modifying or distributing the Package, you accept this license. Do not +use, modify, or distribute the Package, if you do not accept this +license. + +(11) If your Modified Version has been derived from a Modified +Version made by someone other than you, you are nevertheless required +to ensure that your Modified Version complies with the requirements of +this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, +free-of-charge patent license to make, have made, use, offer to sell, +sell, import and otherwise transfer the Package with respect to any +patent claims licensable by the Copyright Holder that are necessarily +infringed by the Package. If you institute patent litigation +(including a cross-claim or counterclaim) against any party alleging +that the Package constitutes direct or contributory patent +infringement, then this Artistic License to you shall terminate on the +date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL +LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -1,26 +1,38 @@ -Build.PL +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Changes -Makefile.PL +INSTALL +LICENSE MANIFEST +MANIFEST.SKIP +META.json META.yml -README -t/01-ColorNames.t -t/01-version.t +Makefile.PL +README.md +cpanfile +dist.ini +lib/Graphics/ColorNames.pm +lib/Graphics/ColorNames/X.pm +t-etc/rgb.txt +t/00-report-prereqs.dd +t/00-report-prereqs.t +t/01-exports.t t/02-X.t -t/03-HTML.t -t/04-Windows.t -t/05-Netscape.t -t/06-obj.t +t/03-oo.t +t/04-precedence.t +t/05-tied.t t/07-file.t t/08-filehandle.t t/09-colorlibrary.t t/10-sub.t -t/90-file-port.t -t/90-pod-coverage.t -t/90-pod.t -t/rgb.txt -lib/Graphics/ColorNames.pm -lib/Graphics/ColorNames/HTML.pm -lib/Graphics/ColorNames/Netscape.pm -lib/Graphics/ColorNames/Windows.pm -lib/Graphics/ColorNames/X.pm +t/author-eof.t +t/author-eol.t +t/author-minimum-version.t +t/author-no-tabs.t +t/author-pod-linkcheck.t +t/author-pod-syntax.t +t/author-portability.t +t/lib/Graphics/ColorNames/Test.pm +t/release-check-manifest.t +t/release-fixme.t +t/release-trailing-space.t +weaver.ini diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 0000000..71b173b --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1,112 @@ +.*~$ +.*\.(bak|old)$ +\.git/.* +\.gitignore + +# Begin standard Module::Manifest::Skip list: + +# ExtUtils::MakeMaker +^blib/ +^blibdirs$ +^blibdirs\.ts$ +^bpm_to_blib\.ts$ +^Makefile$ +^Makefile\.old$ +^MakeMaker-\d +^MANIFEST\.bak$ +# ^MANIFEST\.SKIP$ +^MYMETA\. +^pm_to_blib$ +^pod2htm.* + +# Module::Build +^Build$ +^_build/ +^Build.bat$ +^Build.COM$ +^BUILD.COM$ +^build.com$ + +# Revision Control +\bCVS\b +\b.cvsignore\b +\b_darcs\b +\B\.git\b +\B\.gitignore\b +\B\.gitmodules\b +\B\.hg\b +\B\.hgignore\b +\B\.hgtags\b +\bRCS\b +\bSCCS\b +\B\.svn\b +,v$ +,B$ +,D$ +\baegis.log$ + +# Author Extras +^inc/.*\.pod$ +^pkg/ +# ^xt/ +# ^dist.ini$ + +# Editors +~$ +\#$ +\b\.# +\.kpf$ +\.sw[pmno]$ +^\.vimrc$ + +# OS X +\.DS_Store$ +^\.Trash/ +\B\._ + +# VMS +\bDescrip.MMS$ +\bDESCRIP.MMS$ +\bdescrip.mms$ + +# Development +^benchmarks/ +^core$ +^cover_db\b +^covered\b +^debian/ +^devel\. +^.devel-local$ +^out$ +^tmon.out$ +^old/ +^Old/ + +# Author Notes +^notes +^todo +^ToDo$ + +# Common Junk Files +\.bak$ +\.diff$ +^foo\b.* +\.old$ +\.orig$ +\.patch$ +\.rej$ +\.tdy$ +\.tmp$ +^\w$ +\.ttc$ +\.pmc$ + +# Added by Dist::Zilla::Plugin::Generate::ManifestSkip +\.build/ +Graphics-ColorNames-.*/ +Graphics-ColorNames-.*\.tar\.gz +\.mailmap$ +perltidy\.(LOG|ERR) +fatlib/ +cpanfile\.snapshot$ +local/ diff --git a/META.json b/META.json new file mode 100644 index 0000000..2ab33fc --- /dev/null +++ b/META.json @@ -0,0 +1,102 @@ +{ + "abstract" : "defines RGB values for common color names", + "author" : [ + "Robert Rothenberg <rrwo@cpan.org>" + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", + "keywords" : [ + "color" + ], + "license" : [ + "artistic_2" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "Graphics-ColorNames", + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "develop" : { + "requires" : { + "Test::EOF" : "0", + "Test::EOL" : "0", + "Test::MinimumVersion" : "0", + "Test::More" : "0.88", + "Test::NoTabs" : "0", + "Test::Pod" : "1.41", + "Test::Pod::LinkCheck" : "0", + "Test::Portability::Files" : "0", + "Test::TrailingSpace" : "0.0203" + } + }, + "runtime" : { + "requires" : { + "Exporter" : "5.57", + "Module::Load" : "0.10", + "Module::Loaded" : "0", + "perl" : "v5.10.0", + "version" : "0" + } + }, + "test" : { + "recommends" : { + "CPAN::Meta" : "2.120900" + }, + "requires" : { + "File::Spec" : "0", + "FileHandle" : "0", + "IO::File" : "0", + "Module::Metadata" : "0", + "Test::Exception" : "0", + "Test::More" : "0", + "Test::Most" : "0", + "constant" : "0", + "lib" : "0", + "perl" : "v5.10.0" + } + } + }, + "provides" : { + "Graphics::ColorNames" : { + "file" : "lib/Graphics/ColorNames.pm", + "version" : "v3.5.0" + }, + "Graphics::ColorNames::X" : { + "file" : "lib/Graphics/ColorNames/X.pm", + "version" : "v3.5.0" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "mailto" : "bug-Graphics-ColorNames@rt.cpan.org", + "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames" + }, + "repository" : { + "type" : "git", + "url" : "git://github.com/robrwo/Graphics-ColorNames.git", + "web" : "https://github.com/robrwo/Graphics-ColorNames" + } + }, + "version" : "v3.5.0", + "x_authority" : "cpan:RRWO", + "x_contributors" : [ + "Alan D. Salewski <alans@cji.com>", + "Steve Pomeroy <xavier@cpan.org>", + "\"chemboy\" <chemboy@perlmonk.org>", + "Magnus Cedergren <magnus@mbox604.swipnet.se>", + "Gary Vollink <gary@vollink.com>", + "Claus F\u00e4rber <cfaerber@cpan.org>", + "Andreas J. K\u00f6nig <andk@cpan.org>", + "Slaven Rezi\u0107 <slaven@rezic.de>" + ], + "x_generated_by_perl" : "v5.28.1", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.11" +} + @@ -1,50 +1,55 @@ --- -name: Graphics-ColorNames -version: 2.11 +abstract: 'defines RGB values for common color names' author: - - 'Robert Rothenberg <rrwo at cpan.org>' -abstract: defines RGB values for common color names -license: perl -resources: - license: http://dev.perl.org/licenses/ -requires: - Carp: 0 - DirHandle: 0 - Exporter: 0 - File::Spec: 0 - IO::File: 0 - Module::Load: 0.10 - Module::Loaded: 0 - base: 0 - perl: 5.006 + - 'Robert Rothenberg <rrwo@cpan.org>' build_requires: - FileHandle: 0 - Test::Exception: 0 - Test::More: 0 -recommends: - Color::Library: 0.02 - Pod::Readme: 0.09 - Test::Pod: 1 - Test::Pod::Coverage: 0 - Test::Portability::Files: 0 - Tie::Sub: 0 + File::Spec: '0' + FileHandle: '0' + IO::File: '0' + Module::Metadata: '0' + Test::Exception: '0' + Test::More: '0' + Test::Most: '0' + constant: '0' + lib: '0' + perl: v5.10.0 +configure_requires: + ExtUtils::MakeMaker: '0' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' +keywords: + - color +license: artistic_2 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Graphics-ColorNames provides: Graphics::ColorNames: file: lib/Graphics/ColorNames.pm - version: 2.11 - Graphics::ColorNames::HTML: - file: lib/Graphics/ColorNames/HTML.pm - version: 2.11 - Graphics::ColorNames::Netscape: - file: lib/Graphics/ColorNames/Netscape.pm - version: 2.11 - Graphics::ColorNames::Windows: - file: lib/Graphics/ColorNames/Windows.pm - version: 2.11 + version: v3.5.0 Graphics::ColorNames::X: file: lib/Graphics/ColorNames/X.pm - version: 2.11 -generated_by: Module::Build version 0.2808 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.2.html - version: 1.2 + version: v3.5.0 +requires: + Exporter: '5.57' + Module::Load: '0.10' + Module::Loaded: '0' + perl: v5.10.0 + version: '0' +resources: + bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames + repository: git://github.com/robrwo/Graphics-ColorNames.git +version: v3.5.0 +x_authority: cpan:RRWO +x_contributors: + - 'Alan D. Salewski <alans@cji.com>' + - 'Steve Pomeroy <xavier@cpan.org>' + - '"chemboy" <chemboy@perlmonk.org>' + - 'Magnus Cedergren <magnus@mbox604.swipnet.se>' + - 'Gary Vollink <gary@vollink.com>' + - 'Claus Färber <cfaerber@cpan.org>' + - 'Andreas J. König <andk@cpan.org>' + - 'Slaven Rezić <slaven@rezic.de>' +x_generated_by_perl: v5.28.1 +x_serialization_backend: 'YAML::Tiny version 1.73' diff --git a/Makefile.PL b/Makefile.PL index aa7951c..72311aa 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,24 +1,69 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.03 +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. +use strict; +use warnings; + +use 5.010000; + use ExtUtils::MakeMaker; -WriteMakefile -( - 'PL_FILES' => {}, - 'INSTALLDIRS' => 'site', - 'NAME' => 'Graphics::ColorNames', - 'EXE_FILES' => [], - 'VERSION_FROM' => 'lib/Graphics/ColorNames.pm', - 'PREREQ_PM' => { - 'base' => 0, - 'Test::Exception' => 0, - 'IO::File' => 0, - 'File::Spec' => 0, - 'FileHandle' => 0, - 'Exporter' => 0, - 'Carp' => 0, - 'Test::More' => 0, - 'Module::Loaded' => 0, - 'Module::Load' => '0.10', - 'DirHandle' => 0 - } - ) -; + +my %WriteMakefileArgs = ( + "ABSTRACT" => "defines RGB values for common color names", + "AUTHOR" => "Robert Rothenberg <rrwo\@cpan.org>", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0 + }, + "DISTNAME" => "Graphics-ColorNames", + "LICENSE" => "artistic_2", + "MIN_PERL_VERSION" => "5.010000", + "NAME" => "Graphics::ColorNames", + "PREREQ_PM" => { + "Exporter" => "5.57", + "Module::Load" => "0.10", + "Module::Loaded" => 0, + "version" => 0 + }, + "TEST_REQUIRES" => { + "File::Spec" => 0, + "FileHandle" => 0, + "IO::File" => 0, + "Module::Metadata" => 0, + "Test::Exception" => 0, + "Test::More" => 0, + "Test::Most" => 0, + "constant" => 0, + "lib" => 0 + }, + "VERSION" => "v3.5.0", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Exporter" => "5.57", + "File::Spec" => 0, + "FileHandle" => 0, + "IO::File" => 0, + "Module::Load" => "0.10", + "Module::Loaded" => 0, + "Module::Metadata" => 0, + "Test::Exception" => 0, + "Test::More" => 0, + "Test::Most" => 0, + "constant" => 0, + "lib" => 0, + "version" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); @@ -1,135 +0,0 @@ -NAME - Graphics::ColorNames - defines RGB values for common color names - -REQUIREMENTS - `Graphics::ColorNames' should work on Perl 5.6.0. It requires the - following non-core (depending on your Perl version) modules: - - Module::Load - Module::Loaded - - The following modules are not required for using most features but are - recommended: - - Color::Library - Tie::Sub - - Installation requires the following testing modules: - - Test::Exception - Test::More - - If the `DEVEL_TESTS' environment variable is set, the tests will also - use the following modules for running developer tests, if they are - installed: - - Test::Pod - Test::Pod::Coverage - Test::Portability::Files - - The developer tests are for quality-control purposes. - -INSTALLATION - Installation can be done using the traditional Makefile.PL or the newer - Build.PL methods. - - Using Makefile.PL: - - perl Makefile.PL - make test - make install - - (On Windows platforms you should use `nmake' instead.) - - Using Build.PL (if you have Module::Build installed): - - perl Build.PL - perl Build test - perl Build install - -SYNOPSIS - use Graphics::ColorNames 2.10; - - $po = new Graphics::ColorNames(qw( X )); - - $rgb = $po->hex('green'); # returns '00ff00' - $rgb = $po->hex('green', '0x'); # returns '0x00ff00' - $rgb = $po->hex('green', '#'); # returns '#00ff00' - - $rgb = $po->rgb('green'); # returns '0,255,0' - @rgb = $po->rgb('green'); # returns (0, 255, 0) - - $rgb = $po->green; # same as $po->hex('green'); - - tie %ph, 'Graphics::ColorNames', (qw( X )); - - $rgb = $ph{green}; # same as $po->hex('green'); - -DESCRIPTION - This module provides a common interface for obtaining the RGB values of - colors by standard names. The intention is to (1) provide a common - module that authors can use with other modules to specify colors by - name; and (2) free module authors from having to "re-invent the wheel" - whenever they decide to give the users the option of specifying a color - by name rather than RGB value. - - See the module POD for complete documentation. - -REVISION HISTORY - Changes since the last release: - - 2.11 Thu Jan 10 2008 - - updated version number for release - - minor changes of text format - - added fix for problems with Graphics::ColorNames::GrayScale - - 2.10_05 Tue Jan 8 2008 - * checks if modules already loaded before re-loading them - (uses Module::Loaded for this) - - requires changed to load for dynamically loaded modules - - updated README - - 2.10_04 Sun Jan 6 2008 - - reverted back to standard object-oriented style - - Tie::Sub is only loaded when a subroutine is used for scheme - - 2.10_03 Sat Jan 5 2008 - - tests use Test::Exception to catch errors - - rewrite parts of documentation to emphasize object-oriented - interface rather than the tied interface - - implemented a proper DESTROY method - - misc code cleanup and reorganization - - 2.10_02 Fri Jan 4 2008 - * added support for Color::Library dictionaries - - minor changes to error messages - - underscores in color names ignored - - auto-loading color names in object-oriented interface, e.g. - $obj->black() - - stubs for DESTROY and UNTIE methods - - 06-obj.t test more flexible - - pointless 01-ColourNames test removed - - more updates to documentation - - 2.10_01 Thu Dec 20 2007 - * non-word characters (spaces, punctuation) now ignored in - color names - * smarter handling of comments in rgb.txt files - * significant rewrite to parts of the code, requires Tie::Sub - * rewritten how FIRSTKEY and NEXTKEY methods work - - better error handling - - minor updates to documentation - - typos in comments - - added better checking for minimum Perl version reqs - - added aliaes w/out punctuation in Netscape scheme - - More details can be found in the Changes file. - -AUTHOR - Robert Rothenberg <rrwo at cpan.org> - -LICENSE - Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. This - program is free software; you can redistribute it and/or modify it under - the same terms as Perl itself. - diff --git a/README.md b/README.md new file mode 100644 index 0000000..70b3fb0 --- /dev/null +++ b/README.md @@ -0,0 +1,304 @@ +# NAME + +Graphics::ColorNames - defines RGB values for common color names + +# VERSION + +version v3.5.0 + +# SYNOPSIS + +```perl +use Graphics::ColorNames; +use Graphics::ColorNames::WWW; + +$pal = Graphics::ColorNames->new( qw[ X WWW ] ); + +$rgb = $pal->hex('green'); # returns '00ff00' +$rgb = $pal->hex('green', '0x'); # returns '0x00ff00' +$rgb = $pal->hex('green', '#'); # returns '#00ff00' + +$rgb = $pal->rgb('green'); # returns '0,255,0' +@rgb = $pal->rgb('green'); # returns (0, 255, 0) +``` + +# DESCRIPTION + +This module provides a common interface for obtaining the RGB values +of colors by standard names. The intention is to (1) provide a common +module that authors can use with other modules to specify colors by +name; and (2) free module authors from having to "re-invent the wheel" +whenever they decide to give the users the option of specifying a +color by name rather than RGB value. + +# METHODS + +## `new` + +The constructor is as follows: + +```perl +my $pal = Graphics::ColorNames->new( @schemes ); +``` + +where `@schemes` is an array of color schemes (palettes, dictionaries). + +A valid color scheme may be the name of a color scheme (such as `X` +or a full module name such as `Graphics::ColorNames::X`), a reference +to a color scheme hash or subroutine, or to the path or open +filehandle for a `rgb.txt` file. + +If none are specified, it uses the default `X` color scheme, which +corresponds to the X-Windows `rgb.txt` colors. For most purposes, +this is good enough. Since v3.2.0, it was updated to use the +2014-07-06 colors, so includes the standard CSS colors as well. + +Other color schemes are available on CPAN, +e.g. [Graphics::ColorNames::WWW](https://metacpan.org/pod/Graphics::ColorNames::WWW). + +Since version 2.1002, [Color::Library](https://metacpan.org/pod/Color::Library) dictionaries can be used as +well: + +```perl +my $pal = Graphics::ColorNames->new( 'Color::Library::Dictionary::HTML' ); +``` + +## `rgb` + +``` +@rgb = $pal->rgb($name); + +$rgb = $pal->rgb($name, $separator); +``` + +If called in a list context, returns a triplet. + +If called in a scalar context, returns a string separated by an +optional separator (which defauls to a comma). For example, + +``` +@rgb = $pal->rgb('blue'); # returns (0, 0, 255) + +$rgb = $pal->rgb('blue', ','); # returns "0,0,255" +``` + +Unknown color names return empty lists or strings, depending on the +context. + +Color names are case insensitive, and spaces or punctuation are +ignored. So "Alice Blue" returns the same value as "aliceblue", +"ALICE-BLUE" and "a\*lICEbl-ue". (If you are using color names based +on user input, you should add additional validation of the color +names.) + +The value returned is in the six-digit hexidecimal format used in HTML and +CSS (without the initial '#'). To convert it to separate red, green, and +blue values (between 0 and 255), use the ["hex2tuple"](#hex2tuple) function. + +You may also specify an absolute filename as a color scheme, if the file +is in the same format as the standard `rgb.txt` file. + +## `hex` + +``` +$hex = $pal->hex($name, $prefix); +``` + +Returns a 6-digit hexidecimal RGB code for the color. If an optional +prefix is specified, it will prefix the code with that string. For +example, + +``` +$hex = $pal->hex('blue', '#'); # returns "#0000ff" +``` + +If the color does not exist, it will return an empty string. + +A hexidecimal RGB value in the form of `#RRGGBB`, `0xRRGGBB` or +`RRGGBB` will return itself: + +``` +$color = $pal->hex('#123abc'); # returns '123abc' +``` + +## autoloaded color name methods + +Autoloaded color name methods were removed in v3.4.0. + +## `load_scheme` + +``` +$pal->load_scheme( $scheme ); +``` + +This dynamically loads a color scheme, which can be either a hash +reference or code reference. + +# EXPORTS + +## `all_schemes` + +```perl +my @schemes = all_schemes(); +``` + +Returns a list of all available color schemes installed on the machine +in the `Graphics::ColorNames` namespace. + +The order has no significance. + +## `hex2tuple` + +Converts a hexidecimal string to a tuple. + +## `tuple2hex` + +Converts a tuple to a hexidecimal string. + +# TIED INTERFACE + +The standard interface (prior to version 0.40) was through a tied hash: + +``` +tie %pal, 'Graphics::ColorNames', qw[ X WWW ]; +``` + +This interface is deprecated, and will be moved to a separate module +in the future. + +# CUSTOM COLOR SCHEMES + +You can add naming scheme files by creating a Perl module is the name +`Graphics::ColorNames::SCHEMENAME` which has a subroutine named +`NamesRgbTable` that returns a hash of color names and RGB values. +(Schemes with a different base namespace will require the fill namespace +to be given.) + +The color names must be in all lower-case, and the RGB values must be +24-bit numbers containing the red, green, and blue values in most- significant +to least- significant byte order. + +An example naming schema is below: + +```perl +package Graphics::ColorNames::Metallic; + +sub NamesRgbTable() { + use integer; + return { + copper => 0xb87333, + gold => 0xcd7f32, + silver => 0xe6e8fa, + }; +} +``` + +You would use the above schema as follows: + +``` +tie %colors, 'Graphics::ColorNames', 'Metallic'; +``` + +The behavior of specifying multiple keys with the same name is undefined +as to which one takes precedence. + +As of version 2.10, case, spaces and punctuation are ignored in color +names. So a name like "Willy's Favorite Shade-of-Blue" is treated the +same as "willysfavoroteshadeofblue". (If your scheme does not include +duplicate entrieswith spaces and punctuation, then the minimum +version of [Graphics::ColorNames](https://metacpan.org/pod/Graphics::ColorNames) should be 2.10 in your requirements.) + +An example of an additional module is the [Graphics::ColorNames::Mozilla](https://metacpan.org/pod/Graphics::ColorNames::Mozilla) +module. + +Since version 1.03, `NamesRgbTable` may also return a code reference: + +```perl +package Graphics::ColorNames::Orange; + +sub NamesRgbTable() { + return sub { + my $name = shift; + return 0xffa500; + }; +} +``` + +See [Graphics::ColorNames::GrayScale](https://metacpan.org/pod/Graphics::ColorNames::GrayScale) for an example. + +# ROADMAP + +The following changes are planned in the future: + +- The tied interface will be removed, but implemented in a separate +module for users that wish to use it. +- The namespace for color schemes will be moved to the +`Graphics::ColorNames::Schemes` but options will be added to use the +existing scheme. + + This will allow modules to be named like `Graphics::ColorNames::Tied` + without being confused for color schemes. + +- This module will be rewritten to be a [Moo](https://metacpan.org/pod/Moo)-based class. + +# SEE ALSO + +[Color::Library](https://metacpan.org/pod/Color::Library) provides an extensive library of color schemes. A notable +difference is that it supports more complex schemes which contain additional +information about individual colors and map multiple colors to a single name. + +[Color::Rgb](https://metacpan.org/pod/Color::Rgb) has a similar function to this module, but parses an +`rgb.txt` file. + +[Graphics::ColorObject](https://metacpan.org/pod/Graphics::ColorObject) can convert between RGB and other color space +types. + +[Graphics::ColorUtils](https://metacpan.org/pod/Graphics::ColorUtils) can also convert betweeb RGB and other color +space types, and supports RGB from names in various color schemes. + +[Acme::AutoColor](https://metacpan.org/pod/Acme::AutoColor) provides subroutines corresponding to color names. + +# SOURCE + +The development version is on github at [https://github.com/robrwo/Graphics-ColorNames](https://github.com/robrwo/Graphics-ColorNames) +and may be cloned from [git://github.com/robrwo/Graphics-ColorNames.git](git://github.com/robrwo/Graphics-ColorNames.git) + +The SourceForge project for this module at +[http://sourceforge.net/projects/colornames/](http://sourceforge.net/projects/colornames/) is no longer +maintained. + +# BUGS + +Please report any bugs or feature requests on the bugtracker website +[https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames](https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames) or +by email to +[bug-Graphics-ColorNames@rt.cpan.org](mailto:bug-Graphics-ColorNames@rt.cpan.org). + +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. + +# AUTHOR + +Robert Rothenberg <rrwo@cpan.org> + +# CONTRIBUTORS + +- Alan D. Salewski <alans@cji.com> +- Steve Pomeroy <xavier@cpan.org> +- "chemboy" <chemboy@perlmonk.org> +- Magnus Cedergren <magnus@mbox604.swipnet.se> +- Gary Vollink <gary@vollink.com> +- Claus Färber <cfaerber@cpan.org> +- Andreas J. König <andk@cpan.org> +- Slaven Rezić <slaven@rezic.de> + +# COPYRIGHT AND LICENSE + +This software is Copyright (c) 2001-2019 by Robert Rothenberg. + +This is free software, licensed under: + +``` +The Artistic License 2.0 (GPL Compatible) +``` diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..494ef59 --- /dev/null +++ b/cpanfile @@ -0,0 +1,38 @@ +requires "Exporter" => "5.57"; +requires "Module::Load" => "0.10"; +requires "Module::Loaded" => "0"; +requires "perl" => "v5.10.0"; +requires "version" => "0"; + +on 'test' => sub { + requires "File::Spec" => "0"; + requires "FileHandle" => "0"; + requires "IO::File" => "0"; + requires "Module::Metadata" => "0"; + requires "Test::Exception" => "0"; + requires "Test::More" => "0"; + requires "Test::Most" => "0"; + requires "constant" => "0"; + requires "lib" => "0"; + requires "perl" => "v5.10.0"; +}; + +on 'test' => sub { + recommends "CPAN::Meta" => "2.120900"; +}; + +on 'configure' => sub { + requires "ExtUtils::MakeMaker" => "0"; +}; + +on 'develop' => sub { + requires "Test::EOF" => "0"; + requires "Test::EOL" => "0"; + requires "Test::MinimumVersion" => "0"; + requires "Test::More" => "0.88"; + requires "Test::NoTabs" => "0"; + requires "Test::Pod" => "1.41"; + requires "Test::Pod::LinkCheck" => "0"; + requires "Test::Portability::Files" => "0"; + requires "Test::TrailingSpace" => "0.0203"; +}; diff --git a/debian/changelog b/debian/changelog index 5d8a040..95a7507 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +libgraphics-colornames-perl (3.5.0-1) unstable; urgency=medium + + * New Upstream version + * The licence has been updated to Artistic 2.0 (GPL vompatible) + * The GCN::HTML and GCN::Windows schemes have been removed and released + as separate modules. + * minimum prerequisite Perl v5.10 + * Updated the VCD-* headers to point to the correct repository + * Updated standards version to 4.3.- (no changes were needed) + * Use trhe new debhelp-compat build dependency instead of debian/compat + + -- Manoj Srivastava <srivasta@debian.org> Tue, 12 May 2020 21:56:51 -0700 + libgraphics-colornames-perl (2.11-7.1) unstable; urgency=medium * Non-maintainer upload. diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control index b806a35..91f14eb 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,16 @@ Source: libgraphics-colornames-perl -VCS-Git: https://anonscm.debian.org/git/users/srivasta/debian/libgraphics-colornames-perl.git -VCS-Browser: https://anonscm.debian.org/gitweb/?p=users/srivasta/debian/libgraphics-colornames-perl.git +VCS-Git: https://salsa.debian.org/srivasta/libgraphics-colornames-perl.git +VCS-Browser: https://salsa.debian.org/srivasta/libgraphics-colornames-perl Priority: optional Section: perl Maintainer: Manoj Srivastava <srivasta@debian.org> -Homepage: http://search.cpan.org/~rrwo/Graphics-ColorNames-2.11/lib/Graphics/ColorNames.pm -Standards-Version: 3.9.7 -Build-Depends-Indep: perl, libmodule-build-perl, libmodule-load-perl, +Homepage: https://metacpan.org/release/Graphics-ColorNames +Standards-Version: 4.3.0 +Build-Depends: debhelper-compat (=12) +Build-Depends-Indep: perl, libmodule-build-perl, perl-modules-5.22 | libmodule-load-perl, libpod-coverage-perl, libtest-pod-perl, libtest-exception-perl, - debhelper (>= 9.0.0) + libpod-weaver-perl, libcolor-library-perl (>= 0.2), + libtest-most-perl Package: libgraphics-colornames-perl Architecture: all diff --git a/debian/copyright b/debian/copyright index 2d905d3..e6f752a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,14 +3,14 @@ Upstream-Name: libgraphics-colornames-perl Source: <url:http://search.cpan.org/~rrwo/> Files: * -Copyright: 2001-2008 Robert Rothenberg -License: Artistic-1.0 +Copyright: 2001-2019 Robert Rothenberg +License: Artistic-2.0 Files: debian/* Copyright: 2013 Manoj Srivastava <srivasta@debian.org> -License: Artistic-1.0 +License: Artistic-2.0 -License: Artistic-1.0 +License: Artistic-2.0 This program is free software; you can redistribute it and/or modify it under the terms of the "Artistic License" which comes with Debian. . @@ -20,3 +20,211 @@ License: Artistic-1.0 . On Debian systems, the complete text of the Artistic License can be found in "/usr/share/common-licenses/Artistic". + This software is Copyright (c) 2001-2019 by Robert Rothenberg. + . + This is free software, licensed under: + . + The Artistic License 2.0 (GPL Compatible) + . + The Artistic License 2.0 + . + Copyright (c) 2000-2006, The Perl Foundation. + . + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + . + Preamble + . + This license establishes the terms under which a given free software + Package may be copied, modified, distributed, and/or redistributed. + The intent is that the Copyright Holder maintains some artistic + control over the development of that Package while still keeping the + Package available as open source and free software. + . + You are always permitted to make arrangements wholly outside of this + license directly with the Copyright Holder of a given Package. If the + terms of this license do not permit the full use that you propose to + make of the Package, you should contact the Copyright Holder and seek + a different licensing arrangement. + . + Definitions + . + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + . + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + . + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + . + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + . + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + . + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + . + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + . + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + . + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + . + "Source" form means the source code, documentation source, and + configuration files for the Package. + . + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + . + . + Permission for Use and Modification Without Distribution + . + (1) You are permitted to use the Standard Version and create and use + Modified Versions for any purpose without restriction, provided that + you do not Distribute the Modified Version. + . + . + Permissions for Redistribution of the Standard Version + . + (2) You may Distribute verbatim copies of the Source form of the + Standard Version of this Package in any medium without restriction, + either gratis or for a Distributor Fee, provided that you duplicate + all of the original copyright notices and associated disclaimers. At + your discretion, such verbatim copies may or may not include a + Compiled form of the Package. + . + (3) You may apply any bug fixes, portability changes, and other + modifications made available from the Copyright Holder. The resulting + Package will still be considered the Standard Version, and as such + will be subject to the Original License. + . + . + Distribution of Modified Versions of the Package as Source + . + (4) You may Distribute your Modified Version as Source (either gratis + or for a Distributor Fee, and with or without a Compiled form of the + Modified Version) provided that you clearly document how it differs + from the Standard Version, including, but not limited to, documenting + any non-standard features, executables, or modules, and provided that + you do at least ONE of the following: + . + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + . + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + . + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + . + (i) the Original License or + . + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + . + . + Distribution of Compiled Forms of the Standard Version + or Modified Versions without the Source + . + (5) You may Distribute Compiled forms of the Standard Version without + the Source, provided that you include complete instructions on how to + get the Source of the Standard Version. Such instructions must be + valid at the time of your distribution. If these instructions, at any + time while you are carrying out such distribution, become invalid, you + must provide new instructions on demand or cease further distribution. + If you provide valid instructions or cease distribution within thirty + days after you become aware that the instructions are invalid, then + you do not forfeit any of your rights under this license. + . + (6) You may Distribute a Modified Version in Compiled form without + the Source, provided that you comply with Section 4 with respect to + the Source of the Modified Version. + . + . + Aggregating or Linking the Package + . + (7) You may aggregate the Package (either the Standard Version or + Modified Version) with other packages and Distribute the resulting + aggregation provided that you do not charge a licensing fee for the + Package. Distributor Fees are permitted, and licensing fees for other + components in the aggregation are permitted. The terms of this license + apply to the use and Distribution of the Standard or Modified Versions + as included in the aggregation. + . + (8) You are permitted to link Modified and Standard Versions with + other works, to embed the Package in a larger work of your own, or to + build stand-alone binary or bytecode versions of applications that + include the Package, and Distribute the result without restriction, + provided the result does not expose a direct interface to the Package. + . + . + Items That are Not Considered Part of a Modified Version + . + (9) Works (including, but not limited to, modules and scripts) that + merely extend or make use of the Package, do not, by themselves, cause + the Package to be a Modified Version. In addition, such works are not + considered parts of the Package itself, and are not subject to the + terms of this license. + . + . + General Provisions + . + (10) Any use, modification, and distribution of the Standard or + Modified Versions is governed by this Artistic License. By using, + modifying or distributing the Package, you accept this license. Do not + use, modify, or distribute the Package, if you do not accept this + license. + . + (11) If your Modified Version has been derived from a Modified + Version made by someone other than you, you are nevertheless required + to ensure that your Modified Version complies with the requirements of + this license. + . + (12) This license does not grant you the right to use any trademark, + service mark, tradename, or logo of the Copyright Holder. + . + (13) This license includes the non-exclusive, worldwide, + free-of-charge patent license to make, have made, use, offer to sell, + sell, import and otherwise transfer the Package with respect to any + patent claims licensable by the Copyright Holder that are necessarily + infringed by the Package. If you institute patent litigation + (including a cross-claim or counterclaim) against any party alleging + that the Package constitutes direct or contributory patent + infringement, then this Artistic License to you shall terminate on the + date that such litigation is filed. + . + (14) Disclaimer of Warranty: + THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL + LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + . diff --git a/debian/docs b/debian/docs index e845566..b43bf86 100644 --- a/debian/docs +++ b/debian/docs @@ -1 +1 @@ -README +README.md diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..41f9605 --- /dev/null +++ b/dist.ini @@ -0,0 +1,130 @@ +name = Graphics-ColorNames +author = Robert Rothenberg <rrwo@cpan.org> +license = Artistic_2_0 +copyright_holder = Robert Rothenberg +copyright_year = 2001-2019 + +[Keywords] +keyword = color + +[Meta::Contributors] +contributor = Alan D. Salewski <alans@cji.com> +contributor = Steve Pomeroy <xavier@cpan.org> +contributor = "chemboy" <chemboy@perlmonk.org> +contributor = Magnus Cedergren <magnus@mbox604.swipnet.se> +contributor = Gary Vollink <gary@vollink.com> +contributor = Claus Färber <cfaerber@cpan.org> +contributor = Andreas J. König <andk@cpan.org> +contributor = Slaven Rezić <slaven@rezic.de> + +[GatherDir] +exclude_match = cpanfile* +exclude_filename = MANIFEST.SKIP +[PruneCruft] +[CPANFile] +[License] +[ExtraTests] +[ExecDir] +[ShareDir] +[MakeMaker] +[Manifest] +[TestRelease] +[ConfirmRelease] +[UploadToCPAN] + +[RecommendedPrereqs] +[AutoPrereqs] +[RemovePrereqs] +remove = strict +remove = warnings +remove = integer +remove = base +remove = Carp +remove = File::Spec::Functions + +[EnsurePrereqsInstalled] +:version = 0.003 +type = requires +type = recommends + +[GitHub::Meta] +repo = git://github.com/robrwo/Graphics-ColorNames.git + +[MetaResources] +bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames +bugtracker.mailto = bug-Graphics-ColorNames@rt.cpan.org + +[PodWeaver] +[ReadmeAnyFromPod] +type = gfm +filename = README.md +location = build + +[CopyFilesFromBuild] +copy = README.md +copy = cpanfile +copy = MANIFEST.SKIP + +[Generate::ManifestSkip] +:version = v0.1.5 +[PruneFiles] +match = ~$ + +[Metadata] +x_authority = cpan:RRWO + +[MetaProvides::Package] +[MetaJSON] +[MetaYAML] + +[InstallGuide] + +[Prereqs] +Exporter = 5.57 + +[Prereqs / TestRequires ] + +; authordep Pod::Weaver::Plugin::AppendPrepend +; authordep Pod::Weaver::Section::Contributors +; authordep Pod::Weaver::Section::SourceGitHub + +[PodSyntaxTests] +[Test::CheckManifest] +;;[Test::CleanNamespaces] +[Test::EOF] +[Test::EOL] +:version = 0.14 +[Test::Fixme] +[Test::MinimumVersion] +[Test::NoTabs] +;;[Test::Perl::Critic] +;;critic_config = t/etc/perlcritic.rc + +;;[Test::Pod::Coverage::Configurable] +[Test::Pod::LinkCheck] +[Test::Portability] +; authordep Test::TrailingSpace +[Test::TrailingSpace] +filename_regex = \.(?:p[lm]|pod)\z +;; [Test::Kwalitee] +[Test::ReportPrereqs] +:version = 0.022 +version_extractor = Module::Metadata +verify_prereqs = 1 + +[@Git] +allow_dirty = dist.ini +push_to = origin master:master +tag_format = %v +commit_msg = %v%n%n%c + +[Git::Contributors] +:version = 0.019 + +[RewriteVersion] +[NextRelease] +[BumpVersionAfterRelease] + +[Git::Commit / Commit_Changes] ; commit Changes (for new dev) +allow_dirty_match = ^lib/ +commit_msg = Commit Changes and bump $VERSION diff --git a/lib/Graphics/ColorNames.pm b/lib/Graphics/ColorNames.pm index f50b93b..837aeae 100755 --- a/lib/Graphics/ColorNames.pm +++ b/lib/Graphics/ColorNames.pm @@ -1,212 +1,206 @@ package Graphics::ColorNames; use 5.006; -use base "Exporter"; +# ABSTRACT: defines RGB values for common color names use strict; use warnings; -# use AutoLoader; +use v5.10; + +use Exporter qw/ import /; + use Carp; +use File::Spec::Functions qw/ file_name_is_absolute /; use Module::Load 0.10; use Module::Loaded; -our $VERSION = '2.11'; -# $VERSION = eval $VERSION; +our $VERSION = 'v3.5.0'; our %EXPORT_TAGS = ( - 'all' => [ qw( hex2tuple tuple2hex all_schemes ) ], - 'utility' => [ qw( hex2tuple tuple2hex ) ], + 'all' => [qw( hex2tuple tuple2hex all_schemes )], + 'utility' => [qw( hex2tuple tuple2hex )], ); -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); -our @EXPORT = ( ); +our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); +our @EXPORT = (); + +sub VERSION { + my ( $class, $wanted ) = @_; + require version; + return version->parse($VERSION); +} # We store Schemes in a hash as a quick-and-dirty way to filter # duplicates (which sometimes occur when directories are repeated in # @INC or via symlinks). The order does not matter. -# If we use AutoLoader, these should be use vars() ? - -my %FoundSchemes = ( ); - -# Since 2.10_02, we've added autoloading color names to the object- -# oriented interface. - -our $AUTOLOAD; - -sub AUTOLOAD { - $AUTOLOAD =~ /^(.*:)*([\w\_]+)$/; - my $name = $2; - my $hex = (my $self = $_[0])->FETCH($name); - if (defined $hex) { - return $hex; - } - else { - croak "No method or color named $name"; - # $AutoLoader::AUTOLOAD = $AUTOLOAD; - # goto &AutoLoader::AUTOLOAD; - } -} - +my %FoundSchemes = (); sub _load { - while(my $module = shift) { - unless (is_loaded($module)) { - load($module); - mark_as_loaded($module) unless (is_loaded($module)); + while ( my $module = shift ) { + unless ( is_loaded($module) ) { + load($module); + mark_as_loaded($module) unless ( is_loaded($module) ); + } } - } } # TODO - see if using Tie::Hash::Layered gives an improvement sub _load_scheme_from_module { - my $self = shift; - my $base = __PACKAGE__; + my ($self, $scheme) = @_; + + my $module = + $scheme =~ /^\+/ ? substr( $scheme, 1 ) + : $scheme =~ /^Color::Library::Dictionary::/ ? $scheme + : __PACKAGE__ . '::' . $scheme; - my $module = join('::', $base, (my $scheme = shift)); - eval { _load($module); }; - if ($@) { - eval { _load($module = $scheme); }; + eval { _load($module); }; if ($@) { - croak "Cannot load color naming scheme \`$module\'"; + croak "Cannot load color naming scheme module $module"; } - } - - { - no strict 'refs'; - if ($module =~ $base) { - $self->load_scheme($module->NamesRgbTable); + + if ($module->can('NamesRgbTable')) { + $self->load_scheme( $module->NamesRgbTable ); } - elsif ($module =~ /Color::Library::Dictionary/) { - $self->load_scheme($module->_load_color_list); + elsif ($module->can('_load_color_list')) { + $self->load_scheme( $module->_load_color_list ); } else { - croak "Unknown scheme type: $module"; + croak "Unknown scheme type: $module"; } - } } sub TIEHASH { - my $class = shift || __PACKAGE__; - my $self = { - _schemes => [ ], - _iterator => 0, - }; - - bless $self, $class; - - if (@_) { - foreach my $scheme (@_) { - if (ref $scheme) { - $self->load_scheme( $scheme ); - } - elsif (-r $scheme) { - $self->_load_scheme_from_file( $scheme ); - } - else { - $self->_load_scheme_from_module( $scheme ); - } + my $class = shift || __PACKAGE__; + my $self = { + _schemes => [], + _iterator => 0, + }; + + bless $self, $class; + + if (@_) { + foreach my $scheme (@_) { + if ( ref $scheme ) { + $self->load_scheme($scheme); + } + elsif ($scheme =~ /^\+?(?:\w+[:][:])*\w+$/) { + $self->_load_scheme_from_module($scheme); + } + elsif ( file_name_is_absolute($scheme) ) { + $self->_load_scheme_from_file($scheme); + } + else { + croak "Unknown color scheme: $scheme"; + } + } + } + else { + $self->_load_scheme_from_module('X'); } - } else { - $self->_load_scheme_from_module('X'); - } - return $self; + return $self; } sub FETCH { - my $self = shift; - my $key = lc(shift||""); - - # If we're passing it an RGB value, return that value - - if ($key =~ m/^\x23?([\da-f]{6})$/) { - return $1; - } else { - - $key =~ s/[^a-z\d\%]//g; # ignore non-word characters - - my $val = undef; - my $i = 0; - while ((!defined $val) && ($i < @{$self->{_schemes}})) { - $val = $self->{_schemes}->[$i++]->{$key}; - } - - if (defined $val) { - return sprintf('%06x', $val ), ; - } else { - return; - } - } + my $self = shift; + my $key = lc( shift || "" ); + + # If we're passing it an RGB value, return that value + + if ( $key =~ m/^(?:\x23|0x)?([0-9a-f]{6})$/ ) { + return $1; + } + else { + + $key =~ s/[^0-9a-z\%]//g; # ignore non-word characters + + my $val = undef; + my $i = 0; + while ( ( !defined $val ) && ( $i < @{ $self->{_schemes} } ) ) { + $val = $self->{_schemes}->[ $i++ ]->{$key}; + } + + if ( defined $val ) { + return sprintf( '%06x', $val ),; + } + else { + return; + } + } } sub EXISTS { - my ($self, $key) = @_; - defined ($self->FETCH($key)); + my ( $self, $key ) = @_; + defined( $self->FETCH($key) ); } sub FIRSTKEY { - (my $self = shift)->{_iterator} = 0; - each %{$self->{_schemes}->[$self->{_iterator}]}; + ( my $self = shift )->{_iterator} = 0; + each %{ $self->{_schemes}->[ $self->{_iterator} ] }; } sub NEXTKEY { - my $self = shift; - my ($key, $val) = each %{$self->{_schemes}->[$self->{_iterator}]}; - unless (defined $key) { - ($key, $val) = each %{$self->{_schemes}->[++$self->{_iterator}]}; - } - return $key; + my $self = shift; + my ( $key, $val ) = each %{ $self->{_schemes}->[ $self->{_iterator} ] }; + unless ( defined $key ) { + ( $key, $val ) = each %{ $self->{_schemes}->[ ++$self->{_iterator} ] }; + } + return $key; } sub load_scheme { - my $self = shift; - my $scheme = shift; + my $self = shift; + my $scheme = shift; - if (ref($scheme) eq "HASH") { - push @{$self->{_schemes}}, $scheme; - } - elsif (ref($scheme) eq "CODE") { - _load("Tie::Sub"); - push @{$self->{_schemes}}, { }; - tie %{$self->{_schemes}->[-1]}, 'Tie::Sub', $scheme; - } - elsif (ref($scheme) eq "ARRAY") { - # assumes these are Color::Library::Dictionary 0.02 files - my $s = { }; - foreach my $rec (@$scheme) { - my $key = $rec->[0]; - my $name = $rec->[1]; - my $code = $rec->[5]; - $name =~ s/[\W\_]//g; # ignore non-word characters - $s->{$name} = $code unless (exists $s->{$name}); - if ($key =~ /^(.+\:.+)\.(\d+)$/) { - $s->{"$name$2"} = $code; - } - } - push @{$self->{_schemes}}, $s; - } - else { - # TODO - use Exception - undef $!; - eval { - if ((ref($scheme) eq 'GLOB') - || ref($scheme) eq "IO::File" || $scheme->isa('IO::File') - || ref($scheme) eq "FileHandle" || $scheme->isa('FileHandle')) { - $self->_load_scheme_from_file($scheme); - } - }; - if ($@) { - croak "Error $@ on scheme type ", ref($scheme); + if ( ref($scheme) eq "HASH" ) { + push @{ $self->{_schemes} }, $scheme; + } + elsif ( ref($scheme) eq "CODE" ) { + _load("Tie::Sub"); + push @{ $self->{_schemes} }, {}; + tie %{ $self->{_schemes}->[-1] }, 'Tie::Sub', $scheme; } - elsif ($!) { - croak "$!"; + elsif ( ref($scheme) eq "ARRAY" ) { + + # assumes these are Color::Library::Dictionary 0.02 files + my $s = {}; + foreach my $rec (@$scheme) { + my $key = $rec->[0]; + my $name = $rec->[1]; + my $code = $rec->[5]; + $name =~ s/[\W\_]//g; # ignore non-word characters + $s->{$name} = $code unless ( exists $s->{$name} ); + if ( $key =~ /^(.+\:.+)\.([0-9]+)$/ ) { + $s->{"$name$2"} = $code; + } + } + push @{ $self->{_schemes} }, $s; } else { - # everything is ok? + # TODO - use Exception + undef $!; + eval { + if ( ( ref($scheme) eq 'GLOB' ) + || ref($scheme) eq "IO::File" + || $scheme->isa('IO::File') + || ref($scheme) eq "FileHandle" + || $scheme->isa('FileHandle') ) + { + $self->_load_scheme_from_file($scheme); + } + }; + if ($@) { + croak "Error $@ on scheme type ", ref($scheme); + } + elsif ($!) { + croak "$!"; + } + else { + # everything is ok? + } } - } } sub _find_schemes { @@ -216,220 +210,168 @@ sub _find_schemes { # BUG: deep-named schemes such as Graphics::ColorNames::Foo::Bar # are not supported. - if (-d $path) { - my $dh = DirHandle->new( $path ) - || croak "Unable to access directory $path"; - while (defined(my $fn = $dh->read)) { - if ((-r File::Spec->catdir($path, $fn)) && ($fn =~ /(.+)\.pm$/)) { - $FoundSchemes{$1}++; - } - } + if ( -d $path ) { + my $dh = DirHandle->new($path) + || croak "Unable to access directory $path"; + while ( defined( my $fn = $dh->read ) ) { + if ( ( -r File::Spec->catdir( $path, $fn ) ) + && ( $fn =~ /(.+)\.pm$/ ) ) + { + $FoundSchemes{$1}++; + } + } } - } +} sub _readonly_error { - croak "Cannot modify a read-only value"; + croak "Cannot modify a read-only value"; } sub DESTROY { - my $self = shift; - delete $self->{_schemes}; - delete $self->{_iterator}; -} - -sub UNTIE { # stub to avoid AUTOLOAD + my $self = shift; + delete $self->{_schemes}; + delete $self->{_iterator}; } BEGIN { - no strict 'refs'; - *STORE = \ &_readonly_error; - *DELETE = \ &_readonly_error; - *CLEAR = \ &_readonly_error; # causes problems with 'undef' + no strict 'refs'; + *STORE = \&_readonly_error; + *DELETE = \&_readonly_error; + *CLEAR = \&_readonly_error; # causes problems with 'undef' - *new = \ &TIEHASH; + *new = \&TIEHASH; } - -1; - -## __END__ - # Convert 6-digit hexidecimal code (used for HTML etc.) to an array of # RGB values sub hex2tuple { - my $rgb = CORE::hex( shift ); - my ($red, $green, $blue); - $blue = ($rgb & 0x0000ff); - $green = ($rgb & 0x00ff00) >> 8; - $red = ($rgb & 0xff0000) >> 16; - return ($red, $green, $blue); + my $rgb = CORE::hex(shift); + my ( $red, $green, $blue ); + $blue = ( $rgb & 0x0000ff ); + $green = ( $rgb & 0x00ff00 ) >> 8; + $red = ( $rgb & 0xff0000 ) >> 16; + return ( $red, $green, $blue ); } - # Convert list of RGB values to 6-digit hexidecimal code (used for HTML, etc.) sub tuple2hex { - my ($red, $green, $blue) = @_; - my $rgb = sprintf "%.2x%.2x%.2x", $red, $green, $blue; - return $rgb; + my ( $red, $green, $blue ) = @_; + my $rgb = sprintf "%.2x%.2x%.2x", $red, $green, $blue; + return $rgb; } sub all_schemes { unless (%FoundSchemes) { - - _load("DirHandle", "File::Spec"); - foreach my $dir (@INC) { - _find_schemes( - File::Spec->catdir($dir, split(/::/, __PACKAGE__))); - } + _load( "DirHandle", "File::Spec" ); + + foreach my $dir (@INC) { + _find_schemes( + File::Spec->catdir( $dir, split( /::/, __PACKAGE__ ) ) ); + } } - return (keys %FoundSchemes); - } + return ( keys %FoundSchemes ); +} sub _load_scheme_from_file { - my $self = shift; - my $file = shift; + my $self = shift; + my $file = shift; - unless (ref $file) { - unless (-r $file) { - croak "Cannot load scheme from file: \'$file\'"; + unless ( ref $file ) { + unless ( -r $file ) { + croak "Cannot load scheme from file: \'$file\'"; + } + _load("IO::File"); } - _load("IO::File"); - } - my $fh = ref($file) ? $file : (IO::File->new); - unless (ref $file) { - open($fh, $file) - || croak "Cannot open file: \'$file\'"; - } + my $fh = ref($file) ? $file : ( IO::File->new ); + unless ( ref $file ) { + open( $fh, $file ) + || croak "Cannot open file: \'$file\'"; + } - my $scheme = { }; + my $scheme = {}; - while (my $line = <$fh>) { - chomp($line); - $line =~ s/[\!\#].*$//; - if ($line ne "") { - my $name = lc(substr($line, 12)); - $name =~ s/[\W]//g; # remove anything that isn't a letter or number + while ( my $line = <$fh> ) { + chomp($line); + $line =~ s/[\!\#].*$//; + if ( $line ne "" ) { + my $name = lc( substr( $line, 12 ) ); + $name =~ s/[\W]//g; # remove anything that isn't a letter or number - croak "Missing color name", - unless ($name ne ""); + croak "Missing color name", + unless ( $name ne "" ); - # TODO? Should we add an option to warn if overlapping names - # are defined? This seems to be too common to be useful. + # TODO? Should we add an option to warn if overlapping names + # are defined? This seems to be too common to be useful. - # unless (exists $scheme->{$name}) { + # unless (exists $scheme->{$name}) { - $scheme->{$name} = 0; - foreach (0, 4, 8) { - $scheme->{$name} <<= 8; - $scheme->{$name} |= (eval substr($line, $_, 3)); - } + $scheme->{$name} = 0; + foreach ( 0, 4, 8 ) { + $scheme->{$name} <<= 8; + $scheme->{$name} |= ( eval substr( $line, $_, 3 ) ); + } - # } - } - } - $self->load_scheme( $scheme ); + # } + } + } + $self->load_scheme($scheme); - unless (ref $file) { - close $fh; - } + unless ( ref $file ) { + close $fh; + } } - sub hex { - my $self = shift; - my $rgb = $self->FETCH(my $name = shift); - my $pre = shift || ""; - return ($pre.$rgb); -} - -sub rgb { - my $self = shift; - my @rgb = hex2tuple($self->FETCH(my $name = shift)); - my $sep = shift || ','; # (*) - return wantarray ? @rgb : join($sep,@rgb); -# (*) A possible bug, if one uses "0" as a separator. But this is not likely -} - -__END__ - -=head1 NAME - -Graphics::ColorNames - defines RGB values for common color names + my ($self, $name, $prefix) = @_; + my $rgb = $self->FETCH($name); -=begin readme + return '' unless defined $rgb; -=head1 REQUIREMENTS + return $rgb unless defined $prefix; -C<Graphics::ColorNames> should work on Perl 5.6.0. It requires the -following non-core (depending on your Perl version) modules: - - Module::Load - Module::Loaded - -The following modules are not required for using most features but -are recommended: - - Color::Library - Tie::Sub - -L<Installation|/INSTALLATION> requires the following testing modules: - - Test::Exception - Test::More - -If the C<DEVEL_TESTS> environment variable is set, the tests will also -use the following modules for running developer tests, if they are -installed: - - Test::Pod - Test::Pod::Coverage - Test::Portability::Files + return $prefix . $rgb; +} -The developer tests are for quality-control purposes. +sub rgb { + my ($self, $name, $separator) = @_; + my $rgb = $self->FETCH($name); + my @rgb = (defined $rgb) ? hex2tuple( $rgb ) : (); + return wantarray ? @rgb : join($separator || ',', @rgb); +} -=head1 INSTALLATION +1; -Installation can be done using the traditional Makefile.PL or the newer -Build.PL methods. +__END__ -Using Makefile.PL: +=pod - perl Makefile.PL - make test - make install +=encoding UTF-8 -(On Windows platforms you should use C<nmake> instead.) +=head1 NAME -Using Build.PL (if you have L<Module::Build> installed): +Graphics::ColorNames - defines RGB values for common color names - perl Build.PL - perl Build test - perl Build install +=head1 VERSION -=end readme +version v3.5.0 =head1 SYNOPSIS - use Graphics::ColorNames 2.10; - - $po = new Graphics::ColorNames(qw( X )); - - $rgb = $po->hex('green'); # returns '00ff00' - $rgb = $po->hex('green', '0x'); # returns '0x00ff00' - $rgb = $po->hex('green', '#'); # returns '#00ff00' - - $rgb = $po->rgb('green'); # returns '0,255,0' - @rgb = $po->rgb('green'); # returns (0, 255, 0) + use Graphics::ColorNames; + use Graphics::ColorNames::WWW; - $rgb = $po->green; # same as $po->hex('green'); + $pal = Graphics::ColorNames->new( qw[ X WWW ] ); - tie %ph, 'Graphics::ColorNames', (qw( X )); + $rgb = $pal->hex('green'); # returns '00ff00' + $rgb = $pal->hex('green', '0x'); # returns '0x00ff00' + $rgb = $pal->hex('green', '#'); # returns '#00ff00' - $rgb = $ph{green}; # same as $po->hex('green'); + $rgb = $pal->rgb('green'); # returns '0,255,0' + @rgb = $pal->rgb('green'); # returns (0, 255, 0) =head1 DESCRIPTION @@ -440,222 +382,122 @@ name; and (2) free module authors from having to "re-invent the wheel" whenever they decide to give the users the option of specifying a color by name rather than RGB value. -=begin readme - -See the module POD for complete documentation. - -=end readme - -=for readme stop - -For example, - - use Graphics::ColorNames 2.10; +=head1 METHODS - use GD; +=head2 C<new> - $pal = new Graphics::ColorNames; +The constructor is as follows: - $img = new GD::Image(100, 100); + my $pal = Graphics::ColorNames->new( @schemes ); - $bgColor = $img->colorAllocate( $pal->rgb('CadetBlue3') ); - -Although this is a little "bureaucratic", the meaning of this code is clear: -C<$bgColor> (or background color) is 'CadetBlue3' (which is easier to for one -to understand than C<0x7A, 0xC5, 0xCD>). The variable is named for its -function, not form (ie, C<$CadetBlue3>) so that if the author later changes -the background color, the variable name need not be changed. - -You can also define L</Custom Color Schemes> for specialised palettes -for websites or institutional publications: - - $color = $pal->hex('MenuBackground'); - -As an added feature, a hexidecimal RGB value in the form of #RRGGBB, -0xRRGGBB or RRGGBB will return itself: - - $color = $pal->hex('#123abc'); # returns '123abc' - -=head2 Tied Interface - -The standard interface (prior to version 0.40) is through a tied hash: - - tie %pal, 'Graphics::ColorNames', @schemes; - -where C<%pal> is the tied hash and C<@schemes> is a list of -L<color schemes|/Color Schemes>. +where C<@schemes> is an array of color schemes (palettes, dictionaries). A valid color scheme may be the name of a color scheme (such as C<X> or a full module name such as C<Graphics::ColorNames::X>), a reference to a color scheme hash or subroutine, or to the path or open filehandle for a F<rgb.txt> file. -As of version 2.1002, one can also use L<Color::Library> dictionaries: +If none are specified, it uses the default C<X> color scheme, which +corresponds to the X-Windows F<rgb.txt> colors. For most purposes, +this is good enough. Since v3.2.0, it was updated to use the +2014-07-06 colors, so includes the standard CSS colors as well. + +Other color schemes are available on CPAN, +e.g. L<Graphics::ColorNames::WWW>. - tie %pal, 'Graphics::ColorNames', qw(Color::Library::Dictionary::HTML); +Since version 2.1002, L<Color::Library> dictionaries can be used as +well: -This is an experimental feature which may change in later versions (see -L</SEE ALSO> for a discussion of the differences between modules). + my $pal = Graphics::ColorNames->new( 'Color::Library::Dictionary::HTML' ); -Multiple schemes can be used: +=head2 C<rgb> - tie %pal, 'Graphics::ColorNames', qw(HTML Netscape); + @rgb = $pal->rgb($name); -In this case, if the name is not a valid HTML color, the Netscape name -will be used. + $rgb = $pal->rgb($name, $separator); -One can load all available schemes in the Graphics::ColorNames namespace -(as of version 2.0): +If called in a list context, returns a triplet. + +If called in a scalar context, returns a string separated by an +optional separator (which defauls to a comma). For example, - use Graphics::ColorNames 2.0, 'all_schemes'; - tie %NameTable, 'Graphics::ColorNames', all_schemes(); + @rgb = $pal->rgb('blue'); # returns (0, 0, 255) -When multiple color schemes define the same name, then the earlier one -listed has priority (however, hash-based color schemes always have -priority over code-based color schemes). + $rgb = $pal->rgb('blue', ','); # returns "0,0,255" -When no color scheme is specified, the X-Windows scheme is assumed. +Unknown color names return empty lists or strings, depending on the +context. -Color names are case insensitive, and spaces or punctuation -are ignored. So "Alice Blue" returns the same -value as "aliceblue", "ALICE-BLUE" and "a*lICEbl-ue". (If you are -using color names based on user input, you may want to add additional -validation of the color names.) +Color names are case insensitive, and spaces or punctuation are +ignored. So "Alice Blue" returns the same value as "aliceblue", +"ALICE-BLUE" and "a*lICEbl-ue". (If you are using color names based +on user input, you should add additional validation of the color +names.) The value returned is in the six-digit hexidecimal format used in HTML and CSS (without the initial '#'). To convert it to separate red, green, and blue values (between 0 and 255), use the L</hex2tuple> function. -=head2 Object-Oriented Interface - -If you prefer, an object-oriented interface is available: - - use Graphics::ColorNames 0.40; - - $obj = Graphics::ColorNames->new('/etc/rgb.txt'); - - $hex = $obj->hex('skyblue'); # returns "87ceeb" - @rgb = $obj->rgb('skyblue'); # returns (0x87, 0xce, 0xeb) - -The interface is similar to the L<Color::Rgb> module: - -=over - -=item new +You may also specify an absolute filename as a color scheme, if the file +is in the same format as the standard F<rgb.txt> file. - $obj = Graphics::ColorNames->new( @SCHEMES ); +=head2 C<hex> -Creates the object, using the default L<color schemes|/Color Schemes>. -If none are specified, it uses the C<X> scheme. - -=item load_scheme - - $obj->load_scheme( $scheme ); - -Loads a scheme dynamically. The scheme may be any hash or code reference. - -=item hex - - $hex = $obj->hex($name, $prefix); + $hex = $pal->hex($name, $prefix); Returns a 6-digit hexidecimal RGB code for the color. If an optional prefix is specified, it will prefix the code with that string. For example, - $hex = $obj->hex('blue', '#'); # returns "#0000ff" - -=item rgb - - @rgb = $obj->rgb($name); - - $rgb = $obj->rgb($name, $separator); - -If called in a list context, returns a triplet. - -If called in a scalar context, returns a string separated by an -optional separator (which defauls to a comma). For example, - - @rgb = $obj->rgb('blue'); # returns (0, 0, 255) + $hex = $pal->hex('blue', '#'); # returns "#0000ff" - $rgb = $obj->rgb('blue', ','); # returns "0,0,255" +If the color does not exist, it will return an empty string. -=back +A hexidecimal RGB value in the form of C<#RRGGBB>, C<0xRRGGBB> or +C<RRGGBB> will return itself: -Since version 2.10_02, the interface will assume method names -are color names and return the hex value, + $color = $pal->hex('#123abc'); # returns '123abc' - $obj->black eq $obj->hex("black") +=head2 autoloaded color name methods -Method names are case-insensitive, and underscores are ignored. +Autoloaded color name methods were removed in v3.4.0. -=head2 Utility Functions +=head2 C<load_scheme> -These functions are not exported by default, so much be specified to -be used: + $pal->load_scheme( $scheme ); - use Graphics::ColorNames qw( all_schemes hex2tuple tuple2hex ); +This dynamically loads a color scheme, which can be either a hash +reference or code reference. -=over +=head1 EXPORTS -=item all_schemes +=head2 C<all_schemes> - @schemes = all_schemes(); + my @schemes = all_schemes(); Returns a list of all available color schemes installed on the machine in the F<Graphics::ColorNames> namespace. The order has no significance. -=item hex2tuple - - ($red, $green, $blue) = hex2tuple( $colors{'AliceBlue'}); - -=item tuple2hex - - $rgb = tuple2hex( $red, $green, $blue ); - -=back - -=head2 Color Schemes +=head2 C<hex2tuple> -The following schemes are available by default: +Converts a hexidecimal string to a tuple. -=over +=head2 C<tuple2hex> -=item X +Converts a tuple to a hexidecimal string. -About 750 color names used in X-Windows (although about 90+ of them are -duplicate names with spaces). +=head1 TIED INTERFACE -=item HTML +The standard interface (prior to version 0.40) was through a tied hash: -16 common color names defined in the HTML 4.0 specification. These -names are also used with older CSS and SVG specifications. (You may -want to see L<Graphics::ColorNames::SVG> for a complete list.) + tie %pal, 'Graphics::ColorNames', qw[ X WWW ]; -=item Netscape +This interface is deprecated, and will be moved to a separate module +in the future. -100 color names names associated Netscape 1.1 (I cannot determine whether -they were once usable in Netscape or were arbitrary names for RGB values-- -many of these names are not recognized by later versions of Netscape). - -This scheme may be deprecated in future versions, but available as a -separate module. - -=item Windows - -16 commom color names used with Microsoft Windows and related -products. These are actually the same colors as the L</HTML> scheme, -although with different names. - -=back - -Rather than a color scheme, the path or open filehandle for a -F<rgb.txt> file may be specified. - -Additional color schemes may be available on CPAN. - -=head2 Custom Color Schemes +=head1 CUSTOM COLOR SCHEMES You can add naming scheme files by creating a Perl module is the name C<Graphics::ColorNames::SCHEMENAME> which has a subroutine named @@ -694,7 +536,7 @@ duplicate entrieswith spaces and punctuation, then the minimum version of L<Graphics::ColorNames> should be 2.10 in your requirements.) An example of an additional module is the L<Graphics::ColorNames::Mozilla> -module by Steve Pomeroy. +module. Since version 1.03, C<NamesRgbTable> may also return a code reference: @@ -703,21 +545,37 @@ Since version 1.03, C<NamesRgbTable> may also return a code reference: sub NamesRgbTable() { return sub { my $name = shift; - return 0xffa500; + return 0xffa500; }; } See L<Graphics::ColorNames::GrayScale> for an example. -=head2 Graphics::ColourNames +=head1 ROADMAP + +The following changes are planned in the future: + +=over 4 + +=item * -The alias "Graphics::ColourNames" (British spelling) is no longer available -as of version 2.01. +The tied interface will be removed, but implemented in a separate +module for users that wish to use it. -It seems absurd to maintain it when all the modules does is provide an -alternative spelling for the module I<name> without doing anything about -the component colors of each scheme, and when most other modules -(and non-Perl software) does not bother with such things. +=item * + +The namespace for color schemes will be moved to the +C<Graphics::ColorNames::Schemes> but options will be added to use the +existing scheme. + +This will allow modules to be named like C<Graphics::ColorNames::Tied> +without being confused for color schemes. + +=item * + +This module will be rewritten to be a L<Moo>-based class. + +=back =head1 SEE ALSO @@ -731,55 +589,81 @@ F<rgb.txt> file. L<Graphics::ColorObject> can convert between RGB and other color space types. -L<Acme::AutoColor> provides subroutines corresponding to color names. +L<Graphics::ColorUtils> can also convert betweeb RGB and other color +space types, and supports RGB from names in various color schemes. -=begin readme +L<Acme::AutoColor> provides subroutines corresponding to color names. -=head1 REVISION HISTORY +=head1 SOURCE -Changes since the last release: +The development version is on github at L<https://github.com/robrwo/Graphics-ColorNames> +and may be cloned from L<git://github.com/robrwo/Graphics-ColorNames.git> -=for readme include file=Changes start=^2.11 stop=^2.04 type=text +The SourceForge project for this module at +L<http://sourceforge.net/projects/colornames/> is no longer +maintained. -More details can be found in the F<Changes> file. +=head1 BUGS -=end readme +Please report any bugs or feature requests on the bugtracker website +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames> or +by email to +L<bug-Graphics-ColorNames@rt.cpan.org|mailto:bug-Graphics-ColorNames@rt.cpan.org>. -=for readme continue +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. =head1 AUTHOR -Robert Rothenberg <rrwo at cpan.org> +Robert Rothenberg <rrwo@cpan.org> + +=head1 CONTRIBUTORS + +=for stopwords Alan D. Salewski Steve Pomeroy "chemboy" Magnus Cedergren Gary Vollink Claus Färber Andreas J. König Slaven Rezić + +=over 4 -=for readme stop +=item * -=head2 Acknowledgements +Alan D. Salewski <alans@cji.com> -Alan D. Salewski <alans at cji.com> for feedback and the addition of -C<tuple2hex>. +=item * -Steve Pomeroy <xavier at cpan.org>, "chemboy" <chemboy at perlmonk.org> -and "magnus" <magnus at mbox604.swipnet.se> who pointed out issues -with various color schemes. +Steve Pomeroy <xavier@cpan.org> -=head2 Suggestions and Bug Reporting +=item * -Feedback is always welcome. Please use the CPAN Request Tracker at -L<http://rt.cpan.org> to submit bug reports. +"chemboy" <chemboy@perlmonk.org> -There is a Sourceforge project for this package at -L<http://sourceforge.net/projects/colornames/>. +=item * + +Magnus Cedergren <magnus@mbox604.swipnet.se> + +=item * + +Gary Vollink <gary@vollink.com> + +=item * + +Claus Färber <cfaerber@cpan.org> + +=item * + +Andreas J. König <andk@cpan.org> + +=item * + +Slaven Rezić <slaven@rezic.de> + +=back -If you create additional color schemes, please make them available -separately in CPAN rather than submit them to me for inclusion into -this module. +=head1 COPYRIGHT AND LICENSE -=for readme continue +This software is Copyright (c) 2001-2019 by Robert Rothenberg. -=head1 LICENSE +This is free software, licensed under: -Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. + The Artistic License 2.0 (GPL Compatible) =cut diff --git a/lib/Graphics/ColorNames/HTML.pm b/lib/Graphics/ColorNames/HTML.pm deleted file mode 100755 index 05036ab..0000000 --- a/lib/Graphics/ColorNames/HTML.pm +++ /dev/null @@ -1,76 +0,0 @@ -package Graphics::ColorNames::HTML; - -=head1 NAME - -Graphics::ColorNames::HTML - HTML color names and equivalent RGB values - -=head1 SYNOPSIS - - require Graphics::ColorNames::HTML; - - $NameTable = Graphics::ColorNames::HTML->NamesRgbTable(); - $RgbBlack = $NameTable->{black}; - -=head1 DESCRIPTION - -This module defines color names and their associated RGB values from the -HTML 4.0 Specification. - -=head2 Note - -In versions prior to 1.1, "fuchsia" was misspelled "fuscia". This -mispelling came from un unidentified HTML specification. It also -appears to be a common misspelling, so rather than change it, the -proper spelling was added. - -=head1 SEE ALSO - -L<Graphics::ColorNames>, HTML 4.0 Specificiation <http://www.w3.org> - -L<Graphics::ColorNames::SVG>, which uses color names based on the SVG -specification (which is more recent). - -=head1 AUTHOR - -Robert Rothenberg <rrwo at cpan.org> - -=head1 LICENSE - -Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=cut - -use strict; -use warnings; - -our $VERSION = '2.11'; -#$VERSION = eval $VERSION; - -sub NamesRgbTable() { - use integer; - return { - 'black' => 0x000000, - 'blue' => 0x0000ff, - 'aqua' => 0x00ffff, - 'lime' => 0x00ff00, - 'fuchsia' => 0xff00ff, # "fuscia" is incorrect but common - 'fuscia' => 0xff00ff, # mis-spelling... - 'red' => 0xff0000, - 'yellow' => 0xffff00, - 'white' => 0xffffff, - 'navy' => 0x000080, - 'teal' => 0x008080, - 'green' => 0x008000, - 'purple' => 0x800080, - 'maroon' => 0x800000, - 'olive' => 0x808000, - 'gray' => 0x808080, - 'silver' => 0xc0c0c0, - }; -} - -1; - -__END__ diff --git a/lib/Graphics/ColorNames/Netscape.pm b/lib/Graphics/ColorNames/Netscape.pm deleted file mode 100755 index a694a83..0000000 --- a/lib/Graphics/ColorNames/Netscape.pm +++ /dev/null @@ -1,175 +0,0 @@ -package Graphics::ColorNames::Netscape; - -=head1 NAME - -Graphics::ColorNames::Netscape - Netscape 1.1 Color Names - -=head1 SYNOPSIS - - require Graphics::ColorNames::Netscape; - - $NameTable = Graphics::ColorNames::Netscape->NamesRgbTable(); - $RgbBlack = $NameTable->{black}; - -=head1 DESCRIPTION - -This module defines color names and their associated RGB values associated -with Netscape 1.1 (I cannot determine whether they were once usable in -Netscape or were arbitrary names for RGB values-- I<many of these names are -not recognized by later versions of Netscape>). - -This scheme is deprecated, and will be removed from future versions of -L<Graphics::ColorNames> but available as a separate module from CPAN. - -=head1 SEE ALSO - -L<Graphics::ColorNames> - -L<Graphics::ColorNames::Mozilla> - -L<Graphics::ColorNames::IE> - -L<Graphics::ColorNames::SVG> - -The color names come from L<http://wp.netscape.com/home/bg/colorindex.html>. -Corrections to errors in the Netscape spec are due to -L<http://www.he.net/info/color/>. - -=head1 AUTHOR - -Robert Rothenberg <rrwo at cpan.org> - -=head2 Acknowledgements - -"Magnus", who pointed out inconsistencies. - -Gary Vollink, who suggested color schemes for later Netscape versions, -and pointed out that the original Netscape page had moved. - -=head1 LICENSE - -Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - -=cut - -use strict; -use warnings; - -our $VERSION = '2.11'; -#$VERSION = eval $VERSION; - -# See http://home1.netscape.com/home/bg/colorindex.html - -sub NamesRgbTable() { - use integer; - return { - "white" =>0xffffff, - "red" =>0xff0000, - "green" =>0x00ff00, - "blue" =>0x0000ff, - "magenta" =>0xff00ff, - "cyan" =>0x00ffff, - "yellow" =>0xffff00, - "black" =>0x000000, - "aquamarine" =>0x70db93, - "bakerschocolate" =>0x5c3317, - "blueviolet" =>0x9f5f9f, - "brass" =>0xb5a642, - "brightgold" =>0xd9d919, - "brown" =>0xa62a2a, - "bronze" =>0x8c7853, - "bronzeii" =>0xa67d3d, - "cadetblue" =>0x5f9f9f, - "coolcopper" =>0xd98719, - "copper" =>0xb87333, - "coral" =>0xff7f00, - "cornflowerblue" =>0x42426f, - "darkbrown" =>0x5c4033, - "darkgreen" =>0x2f4f2f, - "darkgreencopper" =>0x4a766e, - "darkolivegreen" =>0x4f4f2f, - "darkorchid" =>0x9932cd, - "darkpurple" =>0x871f78, - "darkslateblue" =>0x241882, - "darkslategrey" =>0x2f4f4f, - "darktan" =>0x97694f, - "darkturquoise" =>0x7093db, - "darkwood" =>0x855e42, - "dimgrey" =>0x545454, - "dustyrose" =>0x856363, - "feldspar" =>0xd19275, - "firebrick" =>0x8e2323, - "flesh" =>0xf5ccb0, - "forestgreen" =>0x238e23, - "gold" =>0xcd7f32, # - "goldenrod" =>0xdbdb70, - "grey" =>0x545454, - "greencopper" =>0x856363, - "greenyellow" =>0xd19275, - "huntergreen" =>0x8e2323, - "indianred" =>0xf5ccb0, - "khaki" =>0x238e23, - "lightblue" =>0xcdd9d9, # - "lightgrey" =>0xdbdb70, - "lightsteelblue" =>0x545454, - "lightwood" =>0x856363, - "limegreen" =>0xd19275, - "mandarianorange" =>0x8e2323, - "maroon" =>0xf5ccb0, - "mediumaquamarine" =>0x238e23, - "mediumblue" =>0x3232cd, # - "mediumforestgreen" =>0xdbdb70, - "mediumgoldenrod" =>0xeaeaae, - "mediumorchid" =>0x9370db, - "mediumseagreen" =>0x426f42, - "mediumslateblue" =>0x7f00ff, - "mediumspringgreen" =>0x7fff00, - "mediumturquoise" =>0x70dbdb, - "mediumvioletred" =>0xdb7093, - "mediumwood" =>0xa68064, - "midnightblue" =>0x2f2f4f, - "navyblue" =>0x23238e, - "neonblue" =>0x4d4dff, - "neonpink" =>0xff6ec7, - "newmidnightblue" =>0x00009c, - "newtan" =>0xebc79e, - "oldgold" =>0xcfb53b, - "orange" =>0xff7f00, - "orangered" =>0xff2400, - "orchid" =>0xdb70db, - "palegreen" =>0x8fbc8f, - "pink" =>0xbc8f8f, - "plum" =>0xeaadea, - "quartz" =>0xd9d9f3, - "richblue" =>0x5959ab, - "salmon" =>0x6f4242, - "scarlet" =>0x8c1717, - "seagreen" =>0x238e68, - "semisweetchocolate" =>0x6b4226, - "sienna" =>0x8e6b23, - "silver" =>0xe6e8fa, - "skyblue" =>0x3299cc, - "slateblue" =>0x007fff, - "spicypink" =>0xff1cae, - "springgreen" =>0x00ff7f, - "steelblue" =>0x236b8e, - "summersky" =>0x38b0de, - "tan" =>0xdb9370, - "thistle" =>0xd8bfd8, - "turquoise" =>0xadeaea, - "verydarkbrown" =>0x5c4033, - "verylightgrey" =>0xcdcdcd, - "violet" =>0x4f2f4f, - "violetred" =>0xcc3299, - "wheat" =>0xd8d8bf, - "yellowgreen" =>0x99cc32, - }; -} - - -1; - -__END__ - diff --git a/lib/Graphics/ColorNames/Windows.pm b/lib/Graphics/ColorNames/Windows.pm deleted file mode 100755 index ef39abc..0000000 --- a/lib/Graphics/ColorNames/Windows.pm +++ /dev/null @@ -1,66 +0,0 @@ -package Graphics::ColorNames::Windows; - -=head1 NAME - -Graphics::ColorNames::Windows - Windows color names and equivalent RGB values - -=head1 SYNOPSIS - - require Graphics::ColorNames::Windows; - - $NameTable = Graphics::ColorNames::Windows->NamesRgbTable(); - $RgbBlack = $NameTable->{black}; - -=head1 DESCRIPTION - -This module defines color names and their associated RGB values used in -Microsoft Windows. - -=head1 SEE ALSO - -C<Graphics::ColorNames> - -=head1 AUTHOR - -Robert Rothenberg <rrwo at cpan.org> - -=head1 LICENSE - -Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - - -=cut - -use strict; -use warnings; - -our $VERSION = '2.11'; -#$VERSION = eval $VERSION; - -sub NamesRgbTable() { - use integer; - return { - 'black' => 0x000000, - 'blue' => 0x0000ff, - 'cyan' => 0x00ffff, - 'green' => 0x00ff00, - 'magenta' => 0xff00ff, - 'red' => 0xff0000, - 'yellow' => 0xffff00, - 'white' => 0xffffff, - 'darkblue' => 0x000080, - 'darkcyan' => 0x008080, - 'darkgreen' => 0x008000, - 'darkmagenta' => 0x800080, - 'darkred' => 0x800000, - 'darkyellow' => 0x808000, - 'darkgray' => 0x808080, - 'lightgray' => 0xc0c0c0, - }; -} - -1; - -__END__ diff --git a/lib/Graphics/ColorNames/X.pm b/lib/Graphics/ColorNames/X.pm index 481f329..35c413e 100755 --- a/lib/Graphics/ColorNames/X.pm +++ b/lib/Graphics/ColorNames/X.pm @@ -1,9 +1,712 @@ package Graphics::ColorNames::X; +# ABSTRACT: X-Windows color names and equivalent RGB values + + +use strict; +use warnings; + +our $VERSION = 'v3.5.0'; + + +sub NamesRgbTable() { + use integer; + return { + "snow" => 0xfffafa, + "ghostwhite" => 0xf8f8ff, + "whitesmoke" => 0xf5f5f5, + "gainsboro" => 0xdcdcdc, + "floralwhite" => 0xfffaf0, + "oldlace" => 0xfdf5e6, + "linen" => 0xfaf0e6, + "antiquewhite" => 0xfaebd7, + "papayawhip" => 0xffefd5, + "blanchedalmond" => 0xffebcd, + "bisque" => 0xffe4c4, + "peachpuff" => 0xffdab9, + "navajowhite" => 0xffdead, + "moccasin" => 0xffe4b5, + "cornsilk" => 0xfff8dc, + "ivory" => 0xfffff0, + "lemonchiffon" => 0xfffacd, + "seashell" => 0xfff5ee, + "honeydew" => 0xf0fff0, + "mintcream" => 0xf5fffa, + "azure" => 0xf0ffff, + "aliceblue" => 0xf0f8ff, + "lavender" => 0xe6e6fa, + "lavenderblush" => 0xfff0f5, + "mistyrose" => 0xffe4e1, + "white" => 0xffffff, + "black" => 0x000000, + "darkslategray" => 0x2f4f4f, + "darkslategrey" => 0x2f4f4f, + "dimgray" => 0x696969, + "dimgrey" => 0x696969, + "slategray" => 0x708090, + "slategrey" => 0x708090, + "lightslategray" => 0x778899, + "lightslategrey" => 0x778899, + "gray" => 0xbebebe, + "grey" => 0xbebebe, + "x11gray" => 0xbebebe, + "x11grey" => 0xbebebe, + "webgray" => 0x808080, + "webgrey" => 0x808080, + "lightgrey" => 0xd3d3d3, + "lightgray" => 0xd3d3d3, + "midnightblue" => 0x191970, + "navy" => 0x000080, + "navyblue" => 0x000080, + "cornflowerblue" => 0x6495ed, + "darkslateblue" => 0x483d8b, + "slateblue" => 0x6a5acd, + "mediumslateblue" => 0x7b68ee, + "lightslateblue" => 0x8470ff, + "mediumblue" => 0x0000cd, + "royalblue" => 0x4169e1, + "blue" => 0x0000ff, + "dodgerblue" => 0x1e90ff, + "deepskyblue" => 0x00bfff, + "skyblue" => 0x87ceeb, + "lightskyblue" => 0x87cefa, + "steelblue" => 0x4682b4, + "lightsteelblue" => 0xb0c4de, + "lightblue" => 0xadd8e6, + "powderblue" => 0xb0e0e6, + "paleturquoise" => 0xafeeee, + "darkturquoise" => 0x00ced1, + "mediumturquoise" => 0x48d1cc, + "turquoise" => 0x40e0d0, + "cyan" => 0x00ffff, + "aqua" => 0x00ffff, + "lightcyan" => 0xe0ffff, + "cadetblue" => 0x5f9ea0, + "mediumaquamarine" => 0x66cdaa, + "aquamarine" => 0x7fffd4, + "darkgreen" => 0x006400, + "darkolivegreen" => 0x556b2f, + "darkseagreen" => 0x8fbc8f, + "seagreen" => 0x2e8b57, + "mediumseagreen" => 0x3cb371, + "lightseagreen" => 0x20b2aa, + "palegreen" => 0x98fb98, + "springgreen" => 0x00ff7f, + "lawngreen" => 0x7cfc00, + "green" => 0x00ff00, + "lime" => 0x00ff00, + "x11green" => 0x00ff00, + "webgreen" => 0x008000, + "chartreuse" => 0x7fff00, + "mediumspringgreen" => 0x00fa9a, + "greenyellow" => 0xadff2f, + "limegreen" => 0x32cd32, + "yellowgreen" => 0x9acd32, + "forestgreen" => 0x228b22, + "olivedrab" => 0x6b8e23, + "darkkhaki" => 0xbdb76b, + "khaki" => 0xf0e68c, + "palegoldenrod" => 0xeee8aa, + "lightgoldenrodyellow" => 0xfafad2, + "lightyellow" => 0xffffe0, + "yellow" => 0xffff00, + "gold" => 0xffd700, + "lightgoldenrod" => 0xeedd82, + "goldenrod" => 0xdaa520, + "darkgoldenrod" => 0xb8860b, + "rosybrown" => 0xbc8f8f, + "indianred" => 0xcd5c5c, + "saddlebrown" => 0x8b4513, + "sienna" => 0xa0522d, + "peru" => 0xcd853f, + "burlywood" => 0xdeb887, + "beige" => 0xf5f5dc, + "wheat" => 0xf5deb3, + "sandybrown" => 0xf4a460, + "tan" => 0xd2b48c, + "chocolate" => 0xd2691e, + "firebrick" => 0xb22222, + "brown" => 0xa52a2a, + "darksalmon" => 0xe9967a, + "salmon" => 0xfa8072, + "lightsalmon" => 0xffa07a, + "orange" => 0xffa500, + "darkorange" => 0xff8c00, + "coral" => 0xff7f50, + "lightcoral" => 0xf08080, + "tomato" => 0xff6347, + "orangered" => 0xff4500, + "red" => 0xff0000, + "hotpink" => 0xff69b4, + "deeppink" => 0xff1493, + "pink" => 0xffc0cb, + "lightpink" => 0xffb6c1, + "palevioletred" => 0xdb7093, + "maroon" => 0xb03060, + "x11maroon" => 0xb03060, + "webmaroon" => 0x800000, + "mediumvioletred" => 0xc71585, + "violetred" => 0xd02090, + "magenta" => 0xff00ff, + "fuchsia" => 0xff00ff, + "violet" => 0xee82ee, + "plum" => 0xdda0dd, + "orchid" => 0xda70d6, + "mediumorchid" => 0xba55d3, + "darkorchid" => 0x9932cc, + "darkviolet" => 0x9400d3, + "blueviolet" => 0x8a2be2, + "purple" => 0xa020f0, + "x11purple" => 0xa020f0, + "webpurple" => 0x800080, + "mediumpurple" => 0x9370db, + "thistle" => 0xd8bfd8, + "snow1" => 0xfffafa, + "snow2" => 0xeee9e9, + "snow3" => 0xcdc9c9, + "snow4" => 0x8b8989, + "seashell1" => 0xfff5ee, + "seashell2" => 0xeee5de, + "seashell3" => 0xcdc5bf, + "seashell4" => 0x8b8682, + "antiquewhite1" => 0xffefdb, + "antiquewhite2" => 0xeedfcc, + "antiquewhite3" => 0xcdc0b0, + "antiquewhite4" => 0x8b8378, + "bisque1" => 0xffe4c4, + "bisque2" => 0xeed5b7, + "bisque3" => 0xcdb79e, + "bisque4" => 0x8b7d6b, + "peachpuff1" => 0xffdab9, + "peachpuff2" => 0xeecbad, + "peachpuff3" => 0xcdaf95, + "peachpuff4" => 0x8b7765, + "navajowhite1" => 0xffdead, + "navajowhite2" => 0xeecfa1, + "navajowhite3" => 0xcdb38b, + "navajowhite4" => 0x8b795e, + "lemonchiffon1" => 0xfffacd, + "lemonchiffon2" => 0xeee9bf, + "lemonchiffon3" => 0xcdc9a5, + "lemonchiffon4" => 0x8b8970, + "cornsilk1" => 0xfff8dc, + "cornsilk2" => 0xeee8cd, + "cornsilk3" => 0xcdc8b1, + "cornsilk4" => 0x8b8878, + "ivory1" => 0xfffff0, + "ivory2" => 0xeeeee0, + "ivory3" => 0xcdcdc1, + "ivory4" => 0x8b8b83, + "honeydew1" => 0xf0fff0, + "honeydew2" => 0xe0eee0, + "honeydew3" => 0xc1cdc1, + "honeydew4" => 0x838b83, + "lavenderblush1" => 0xfff0f5, + "lavenderblush2" => 0xeee0e5, + "lavenderblush3" => 0xcdc1c5, + "lavenderblush4" => 0x8b8386, + "mistyrose1" => 0xffe4e1, + "mistyrose2" => 0xeed5d2, + "mistyrose3" => 0xcdb7b5, + "mistyrose4" => 0x8b7d7b, + "azure1" => 0xf0ffff, + "azure2" => 0xe0eeee, + "azure3" => 0xc1cdcd, + "azure4" => 0x838b8b, + "slateblue1" => 0x836fff, + "slateblue2" => 0x7a67ee, + "slateblue3" => 0x6959cd, + "slateblue4" => 0x473c8b, + "royalblue1" => 0x4876ff, + "royalblue2" => 0x436eee, + "royalblue3" => 0x3a5fcd, + "royalblue4" => 0x27408b, + "blue1" => 0x0000ff, + "blue2" => 0x0000ee, + "blue3" => 0x0000cd, + "blue4" => 0x00008b, + "dodgerblue1" => 0x1e90ff, + "dodgerblue2" => 0x1c86ee, + "dodgerblue3" => 0x1874cd, + "dodgerblue4" => 0x104e8b, + "steelblue1" => 0x63b8ff, + "steelblue2" => 0x5cacee, + "steelblue3" => 0x4f94cd, + "steelblue4" => 0x36648b, + "deepskyblue1" => 0x00bfff, + "deepskyblue2" => 0x00b2ee, + "deepskyblue3" => 0x009acd, + "deepskyblue4" => 0x00688b, + "skyblue1" => 0x87ceff, + "skyblue2" => 0x7ec0ee, + "skyblue3" => 0x6ca6cd, + "skyblue4" => 0x4a708b, + "lightskyblue1" => 0xb0e2ff, + "lightskyblue2" => 0xa4d3ee, + "lightskyblue3" => 0x8db6cd, + "lightskyblue4" => 0x607b8b, + "slategray1" => 0xc6e2ff, + "slategray2" => 0xb9d3ee, + "slategray3" => 0x9fb6cd, + "slategray4" => 0x6c7b8b, + "lightsteelblue1" => 0xcae1ff, + "lightsteelblue2" => 0xbcd2ee, + "lightsteelblue3" => 0xa2b5cd, + "lightsteelblue4" => 0x6e7b8b, + "lightblue1" => 0xbfefff, + "lightblue2" => 0xb2dfee, + "lightblue3" => 0x9ac0cd, + "lightblue4" => 0x68838b, + "lightcyan1" => 0xe0ffff, + "lightcyan2" => 0xd1eeee, + "lightcyan3" => 0xb4cdcd, + "lightcyan4" => 0x7a8b8b, + "paleturquoise1" => 0xbbffff, + "paleturquoise2" => 0xaeeeee, + "paleturquoise3" => 0x96cdcd, + "paleturquoise4" => 0x668b8b, + "cadetblue1" => 0x98f5ff, + "cadetblue2" => 0x8ee5ee, + "cadetblue3" => 0x7ac5cd, + "cadetblue4" => 0x53868b, + "turquoise1" => 0x00f5ff, + "turquoise2" => 0x00e5ee, + "turquoise3" => 0x00c5cd, + "turquoise4" => 0x00868b, + "cyan1" => 0x00ffff, + "cyan2" => 0x00eeee, + "cyan3" => 0x00cdcd, + "cyan4" => 0x008b8b, + "darkslategray1" => 0x97ffff, + "darkslategray2" => 0x8deeee, + "darkslategray3" => 0x79cdcd, + "darkslategray4" => 0x528b8b, + "aquamarine1" => 0x7fffd4, + "aquamarine2" => 0x76eec6, + "aquamarine3" => 0x66cdaa, + "aquamarine4" => 0x458b74, + "darkseagreen1" => 0xc1ffc1, + "darkseagreen2" => 0xb4eeb4, + "darkseagreen3" => 0x9bcd9b, + "darkseagreen4" => 0x698b69, + "seagreen1" => 0x54ff9f, + "seagreen2" => 0x4eee94, + "seagreen3" => 0x43cd80, + "seagreen4" => 0x2e8b57, + "palegreen1" => 0x9aff9a, + "palegreen2" => 0x90ee90, + "palegreen3" => 0x7ccd7c, + "palegreen4" => 0x548b54, + "springgreen1" => 0x00ff7f, + "springgreen2" => 0x00ee76, + "springgreen3" => 0x00cd66, + "springgreen4" => 0x008b45, + "green1" => 0x00ff00, + "green2" => 0x00ee00, + "green3" => 0x00cd00, + "green4" => 0x008b00, + "chartreuse1" => 0x7fff00, + "chartreuse2" => 0x76ee00, + "chartreuse3" => 0x66cd00, + "chartreuse4" => 0x458b00, + "olivedrab1" => 0xc0ff3e, + "olivedrab2" => 0xb3ee3a, + "olivedrab3" => 0x9acd32, + "olivedrab4" => 0x698b22, + "darkolivegreen1" => 0xcaff70, + "darkolivegreen2" => 0xbcee68, + "darkolivegreen3" => 0xa2cd5a, + "darkolivegreen4" => 0x6e8b3d, + "khaki1" => 0xfff68f, + "khaki2" => 0xeee685, + "khaki3" => 0xcdc673, + "khaki4" => 0x8b864e, + "lightgoldenrod1" => 0xffec8b, + "lightgoldenrod2" => 0xeedc82, + "lightgoldenrod3" => 0xcdbe70, + "lightgoldenrod4" => 0x8b814c, + "lightyellow1" => 0xffffe0, + "lightyellow2" => 0xeeeed1, + "lightyellow3" => 0xcdcdb4, + "lightyellow4" => 0x8b8b7a, + "yellow1" => 0xffff00, + "yellow2" => 0xeeee00, + "yellow3" => 0xcdcd00, + "yellow4" => 0x8b8b00, + "gold1" => 0xffd700, + "gold2" => 0xeec900, + "gold3" => 0xcdad00, + "gold4" => 0x8b7500, + "goldenrod1" => 0xffc125, + "goldenrod2" => 0xeeb422, + "goldenrod3" => 0xcd9b1d, + "goldenrod4" => 0x8b6914, + "darkgoldenrod1" => 0xffb90f, + "darkgoldenrod2" => 0xeead0e, + "darkgoldenrod3" => 0xcd950c, + "darkgoldenrod4" => 0x8b6508, + "rosybrown1" => 0xffc1c1, + "rosybrown2" => 0xeeb4b4, + "rosybrown3" => 0xcd9b9b, + "rosybrown4" => 0x8b6969, + "indianred1" => 0xff6a6a, + "indianred2" => 0xee6363, + "indianred3" => 0xcd5555, + "indianred4" => 0x8b3a3a, + "sienna1" => 0xff8247, + "sienna2" => 0xee7942, + "sienna3" => 0xcd6839, + "sienna4" => 0x8b4726, + "burlywood1" => 0xffd39b, + "burlywood2" => 0xeec591, + "burlywood3" => 0xcdaa7d, + "burlywood4" => 0x8b7355, + "wheat1" => 0xffe7ba, + "wheat2" => 0xeed8ae, + "wheat3" => 0xcdba96, + "wheat4" => 0x8b7e66, + "tan1" => 0xffa54f, + "tan2" => 0xee9a49, + "tan3" => 0xcd853f, + "tan4" => 0x8b5a2b, + "chocolate1" => 0xff7f24, + "chocolate2" => 0xee7621, + "chocolate3" => 0xcd661d, + "chocolate4" => 0x8b4513, + "firebrick1" => 0xff3030, + "firebrick2" => 0xee2c2c, + "firebrick3" => 0xcd2626, + "firebrick4" => 0x8b1a1a, + "brown1" => 0xff4040, + "brown2" => 0xee3b3b, + "brown3" => 0xcd3333, + "brown4" => 0x8b2323, + "salmon1" => 0xff8c69, + "salmon2" => 0xee8262, + "salmon3" => 0xcd7054, + "salmon4" => 0x8b4c39, + "lightsalmon1" => 0xffa07a, + "lightsalmon2" => 0xee9572, + "lightsalmon3" => 0xcd8162, + "lightsalmon4" => 0x8b5742, + "orange1" => 0xffa500, + "orange2" => 0xee9a00, + "orange3" => 0xcd8500, + "orange4" => 0x8b5a00, + "darkorange1" => 0xff7f00, + "darkorange2" => 0xee7600, + "darkorange3" => 0xcd6600, + "darkorange4" => 0x8b4500, + "coral1" => 0xff7256, + "coral2" => 0xee6a50, + "coral3" => 0xcd5b45, + "coral4" => 0x8b3e2f, + "tomato1" => 0xff6347, + "tomato2" => 0xee5c42, + "tomato3" => 0xcd4f39, + "tomato4" => 0x8b3626, + "orangered1" => 0xff4500, + "orangered2" => 0xee4000, + "orangered3" => 0xcd3700, + "orangered4" => 0x8b2500, + "red1" => 0xff0000, + "red2" => 0xee0000, + "red3" => 0xcd0000, + "red4" => 0x8b0000, + "deeppink1" => 0xff1493, + "deeppink2" => 0xee1289, + "deeppink3" => 0xcd1076, + "deeppink4" => 0x8b0a50, + "hotpink1" => 0xff6eb4, + "hotpink2" => 0xee6aa7, + "hotpink3" => 0xcd6090, + "hotpink4" => 0x8b3a62, + "pink1" => 0xffb5c5, + "pink2" => 0xeea9b8, + "pink3" => 0xcd919e, + "pink4" => 0x8b636c, + "lightpink1" => 0xffaeb9, + "lightpink2" => 0xeea2ad, + "lightpink3" => 0xcd8c95, + "lightpink4" => 0x8b5f65, + "palevioletred1" => 0xff82ab, + "palevioletred2" => 0xee799f, + "palevioletred3" => 0xcd6889, + "palevioletred4" => 0x8b475d, + "maroon1" => 0xff34b3, + "maroon2" => 0xee30a7, + "maroon3" => 0xcd2990, + "maroon4" => 0x8b1c62, + "violetred1" => 0xff3e96, + "violetred2" => 0xee3a8c, + "violetred3" => 0xcd3278, + "violetred4" => 0x8b2252, + "magenta1" => 0xff00ff, + "magenta2" => 0xee00ee, + "magenta3" => 0xcd00cd, + "magenta4" => 0x8b008b, + "orchid1" => 0xff83fa, + "orchid2" => 0xee7ae9, + "orchid3" => 0xcd69c9, + "orchid4" => 0x8b4789, + "plum1" => 0xffbbff, + "plum2" => 0xeeaeee, + "plum3" => 0xcd96cd, + "plum4" => 0x8b668b, + "mediumorchid1" => 0xe066ff, + "mediumorchid2" => 0xd15fee, + "mediumorchid3" => 0xb452cd, + "mediumorchid4" => 0x7a378b, + "darkorchid1" => 0xbf3eff, + "darkorchid2" => 0xb23aee, + "darkorchid3" => 0x9a32cd, + "darkorchid4" => 0x68228b, + "purple1" => 0x9b30ff, + "purple2" => 0x912cee, + "purple3" => 0x7d26cd, + "purple4" => 0x551a8b, + "mediumpurple1" => 0xab82ff, + "mediumpurple2" => 0x9f79ee, + "mediumpurple3" => 0x8968cd, + "mediumpurple4" => 0x5d478b, + "thistle1" => 0xffe1ff, + "thistle2" => 0xeed2ee, + "thistle3" => 0xcdb5cd, + "thistle4" => 0x8b7b8b, + "gray0" => 0x000000, + "grey0" => 0x000000, + "gray1" => 0x030303, + "grey1" => 0x030303, + "gray2" => 0x050505, + "grey2" => 0x050505, + "gray3" => 0x080808, + "grey3" => 0x080808, + "gray4" => 0x0a0a0a, + "grey4" => 0x0a0a0a, + "gray5" => 0x0d0d0d, + "grey5" => 0x0d0d0d, + "gray6" => 0x0f0f0f, + "grey6" => 0x0f0f0f, + "gray7" => 0x121212, + "grey7" => 0x121212, + "gray8" => 0x141414, + "grey8" => 0x141414, + "gray9" => 0x171717, + "grey9" => 0x171717, + "gray10" => 0x1a1a1a, + "grey10" => 0x1a1a1a, + "gray11" => 0x1c1c1c, + "grey11" => 0x1c1c1c, + "gray12" => 0x1f1f1f, + "grey12" => 0x1f1f1f, + "gray13" => 0x212121, + "grey13" => 0x212121, + "gray14" => 0x242424, + "grey14" => 0x242424, + "gray15" => 0x262626, + "grey15" => 0x262626, + "gray16" => 0x292929, + "grey16" => 0x292929, + "gray17" => 0x2b2b2b, + "grey17" => 0x2b2b2b, + "gray18" => 0x2e2e2e, + "grey18" => 0x2e2e2e, + "gray19" => 0x303030, + "grey19" => 0x303030, + "gray20" => 0x333333, + "grey20" => 0x333333, + "gray21" => 0x363636, + "grey21" => 0x363636, + "gray22" => 0x383838, + "grey22" => 0x383838, + "gray23" => 0x3b3b3b, + "grey23" => 0x3b3b3b, + "gray24" => 0x3d3d3d, + "grey24" => 0x3d3d3d, + "gray25" => 0x404040, + "grey25" => 0x404040, + "gray26" => 0x424242, + "grey26" => 0x424242, + "gray27" => 0x454545, + "grey27" => 0x454545, + "gray28" => 0x474747, + "grey28" => 0x474747, + "gray29" => 0x4a4a4a, + "grey29" => 0x4a4a4a, + "gray30" => 0x4d4d4d, + "grey30" => 0x4d4d4d, + "gray31" => 0x4f4f4f, + "grey31" => 0x4f4f4f, + "gray32" => 0x525252, + "grey32" => 0x525252, + "gray33" => 0x545454, + "grey33" => 0x545454, + "gray34" => 0x575757, + "grey34" => 0x575757, + "gray35" => 0x595959, + "grey35" => 0x595959, + "gray36" => 0x5c5c5c, + "grey36" => 0x5c5c5c, + "gray37" => 0x5e5e5e, + "grey37" => 0x5e5e5e, + "gray38" => 0x616161, + "grey38" => 0x616161, + "gray39" => 0x636363, + "grey39" => 0x636363, + "gray40" => 0x666666, + "grey40" => 0x666666, + "gray41" => 0x696969, + "grey41" => 0x696969, + "gray42" => 0x6b6b6b, + "grey42" => 0x6b6b6b, + "gray43" => 0x6e6e6e, + "grey43" => 0x6e6e6e, + "gray44" => 0x707070, + "grey44" => 0x707070, + "gray45" => 0x737373, + "grey45" => 0x737373, + "gray46" => 0x757575, + "grey46" => 0x757575, + "gray47" => 0x787878, + "grey47" => 0x787878, + "gray48" => 0x7a7a7a, + "grey48" => 0x7a7a7a, + "gray49" => 0x7d7d7d, + "grey49" => 0x7d7d7d, + "gray50" => 0x7f7f7f, + "grey50" => 0x7f7f7f, + "gray51" => 0x828282, + "grey51" => 0x828282, + "gray52" => 0x858585, + "grey52" => 0x858585, + "gray53" => 0x878787, + "grey53" => 0x878787, + "gray54" => 0x8a8a8a, + "grey54" => 0x8a8a8a, + "gray55" => 0x8c8c8c, + "grey55" => 0x8c8c8c, + "gray56" => 0x8f8f8f, + "grey56" => 0x8f8f8f, + "gray57" => 0x919191, + "grey57" => 0x919191, + "gray58" => 0x949494, + "grey58" => 0x949494, + "gray59" => 0x969696, + "grey59" => 0x969696, + "gray60" => 0x999999, + "grey60" => 0x999999, + "gray61" => 0x9c9c9c, + "grey61" => 0x9c9c9c, + "gray62" => 0x9e9e9e, + "grey62" => 0x9e9e9e, + "gray63" => 0xa1a1a1, + "grey63" => 0xa1a1a1, + "gray64" => 0xa3a3a3, + "grey64" => 0xa3a3a3, + "gray65" => 0xa6a6a6, + "grey65" => 0xa6a6a6, + "gray66" => 0xa8a8a8, + "grey66" => 0xa8a8a8, + "gray67" => 0xababab, + "grey67" => 0xababab, + "gray68" => 0xadadad, + "grey68" => 0xadadad, + "gray69" => 0xb0b0b0, + "grey69" => 0xb0b0b0, + "gray70" => 0xb3b3b3, + "grey70" => 0xb3b3b3, + "gray71" => 0xb5b5b5, + "grey71" => 0xb5b5b5, + "gray72" => 0xb8b8b8, + "grey72" => 0xb8b8b8, + "gray73" => 0xbababa, + "grey73" => 0xbababa, + "gray74" => 0xbdbdbd, + "grey74" => 0xbdbdbd, + "gray75" => 0xbfbfbf, + "grey75" => 0xbfbfbf, + "gray76" => 0xc2c2c2, + "grey76" => 0xc2c2c2, + "gray77" => 0xc4c4c4, + "grey77" => 0xc4c4c4, + "gray78" => 0xc7c7c7, + "grey78" => 0xc7c7c7, + "gray79" => 0xc9c9c9, + "grey79" => 0xc9c9c9, + "gray80" => 0xcccccc, + "grey80" => 0xcccccc, + "gray81" => 0xcfcfcf, + "grey81" => 0xcfcfcf, + "gray82" => 0xd1d1d1, + "grey82" => 0xd1d1d1, + "gray83" => 0xd4d4d4, + "grey83" => 0xd4d4d4, + "gray84" => 0xd6d6d6, + "grey84" => 0xd6d6d6, + "gray85" => 0xd9d9d9, + "grey85" => 0xd9d9d9, + "gray86" => 0xdbdbdb, + "grey86" => 0xdbdbdb, + "gray87" => 0xdedede, + "grey87" => 0xdedede, + "gray88" => 0xe0e0e0, + "grey88" => 0xe0e0e0, + "gray89" => 0xe3e3e3, + "grey89" => 0xe3e3e3, + "gray90" => 0xe5e5e5, + "grey90" => 0xe5e5e5, + "gray91" => 0xe8e8e8, + "grey91" => 0xe8e8e8, + "gray92" => 0xebebeb, + "grey92" => 0xebebeb, + "gray93" => 0xededed, + "grey93" => 0xededed, + "gray94" => 0xf0f0f0, + "grey94" => 0xf0f0f0, + "gray95" => 0xf2f2f2, + "grey95" => 0xf2f2f2, + "gray96" => 0xf5f5f5, + "grey96" => 0xf5f5f5, + "gray97" => 0xf7f7f7, + "grey97" => 0xf7f7f7, + "gray98" => 0xfafafa, + "grey98" => 0xfafafa, + "gray99" => 0xfcfcfc, + "grey99" => 0xfcfcfc, + "gray100" => 0xffffff, + "grey100" => 0xffffff, + "darkgrey" => 0xa9a9a9, + "darkgray" => 0xa9a9a9, + "darkblue" => 0x00008b, + "darkcyan" => 0x008b8b, + "darkmagenta" => 0x8b008b, + "darkred" => 0x8b0000, + "lightgreen" => 0x90ee90, + "crimson" => 0xdc143c, + "indigo" => 0x4b0082, + "olive" => 0x808000, + "rebeccapurple" => 0x663399, + "silver" => 0xc0c0c0, + "teal" => 0x008080, + }; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + =head1 NAME Graphics::ColorNames::X - X-Windows color names and equivalent RGB values +=head1 VERSION + +version v3.5.0 + =head1 SYNOPSIS require Graphics::ColorNames::X; @@ -14,714 +717,45 @@ Graphics::ColorNames::X - X-Windows color names and equivalent RGB values =head1 DESCRIPTION This module defines color names and their associated RGB values used in -X-Windows (from the X-Windows C<rgb.txt> file). +X-Windows. -=head1 SEE ALSO +It is based on the 2014 version of the F<rgb.txt> file, which includes +colors from CSS4. -L<Graphics::ColorNames>, rgb.txt +=head1 SEE ALSO -=head1 AUTHOR +L<Graphics::ColorNames> -Robert Rothenberg <rrwo at cpan.org> +L<Graphics::ColorNames::CSS> -=head2 Acknowledgements +L<rgb.txt|https://cgit.freedesktop.org/xorg/app/rgb/plain/rgb.txt> -Steve Pomeroy <steve_x at earthling.net> -- fixed the broken color definitions +=head1 SOURCE -=head1 LICENSE +The development version is on github at L<https://github.com/robrwo/Graphics-ColorNames> +and may be cloned from L<git://github.com/robrwo/Graphics-ColorNames.git> -Copyright (c) 2001-2008 Robert Rothenberg. All rights reserved. -This program is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. +=head1 BUGS -=cut +Please report any bugs or feature requests on the bugtracker website +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Graphics-ColorNames> or +by email to +L<bug-Graphics-ColorNames@rt.cpan.org|mailto:bug-Graphics-ColorNames@rt.cpan.org>. -use strict; -use warnings; +When submitting a bug or request, please include a test-file or a +patch to an existing test-file that illustrates the bug or desired +feature. -our $VERSION = '2.11'; -#$VERSION = eval $VERSION; +=head1 AUTHOR -# Original name and colors (v1.01 and earlier) from Kevin J. Walsh, -# http://eies.njit.edu/~walsh/rgb.html +Robert Rothenberg <rrwo@cpan.org> -# Afterwards, XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp -# Verified with Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp +=head1 COPYRIGHT AND LICENSE -# Duplicate namesiwth spaces were removed in v2.10. +This software is Copyright (c) 2001-2019 by Robert Rothenberg. -sub NamesRgbTable() { - use integer; - return { - "snow" => 0xfffafa, - "ghostwhite" => 0xf8f8ff, - "whitesmoke" => 0xf5f5f5, - "gainsboro" => 0xdcdcdc, - "floralwhite" => 0xfffaf0, - "oldlace" => 0xfdf5e6, - "linen" => 0xfaf0e6, - "antiquewhite" => 0xfaebd7, - "papayawhip" => 0xffefd5, - "blanchedalmond" => 0xffebcd, - "bisque" => 0xffe4c4, - "peachpuff" => 0xffdab9, - "navajowhite" => 0xffdead, - "moccasin" => 0xffe4b5, - "cornsilk" => 0xfff8dc, - "ivory" => 0xfffff0, - "lemonchiffon" => 0xfffacd, - "seashell" => 0xfff5ee, - "honeydew" => 0xf0fff0, - "mintcream" => 0xf5fffa, - "azure" => 0xf0ffff, - "aliceblue" => 0xf0f8ff, - "lavender" => 0xe6e6fa, - "lavenderblush" => 0xfff0f5, - "mistyrose" => 0xffe4e1, - "white" => 0xffffff, - "black" => 0x000000, - "darkslategray" => 0x2f4f4f, - "darkslategrey" => 0x2f4f4f, - "dimgray" => 0x696969, - "dimgrey" => 0x696969, - "slategray" => 0x708090, - "slategrey" => 0x708090, - "lightslategray" => 0x778899, - "lightslategrey" => 0x778899, - "gray" => 0xbebebe, - "grey" => 0xbebebe, - "lightgrey" => 0xd3d3d3, - "lightgray" => 0xd3d3d3, - "midnightblue" => 0x191970, - "navy" => 0x000080, - "navyblue" => 0x000080, - "cornflowerblue" => 0x6495ed, - "darkslateblue" => 0x483d8b, - "slateblue" => 0x6a5acd, - "mediumslateblue" => 0x7b68ee, - "lightslateblue" => 0x8470ff, - "mediumblue" => 0x0000cd, - "royalblue" => 0x4169e1, - "blue" => 0x0000ff, - "dodgerblue" => 0x1e90ff, - "deepskyblue" => 0x00bfff, - "skyblue" => 0x87ceeb, - "lightskyblue" => 0x87cefa, - "steelblue" => 0x4682b4, - "lightsteelblue" => 0xb0c4de, - "lightblue" => 0xadd8e6, - "powderblue" => 0xb0e0e6, - "paleturquoise" => 0xafeeee, - "darkturquoise" => 0x00ced1, - "mediumturquoise" => 0x48d1cc, - "turquoise" => 0x40e0d0, - "cyan" => 0x00ffff, - "lightcyan" => 0xe0ffff, - "cadetblue" => 0x5f9ea0, - "mediumaquamarine" => 0x66cdaa, - "aquamarine" => 0x7fffd4, - "darkgreen" => 0x006400, - "darkolivegreen" => 0x556b2f, - "darkseagreen" => 0x8fbc8f, - "seagreen" => 0x2e8b57, - "mediumseagreen" => 0x3cb371, - "lightseagreen" => 0x20b2aa, - "palegreen" => 0x98fb98, - "springgreen" => 0x00ff7f, - "lawngreen" => 0x7cfc00, - "green" => 0x00ff00, - "chartreuse" => 0x7fff00, - "mediumspringgreen" => 0x00fa9a, - "greenyellow" => 0xadff2f, - "limegreen" => 0x32cd32, - "yellowgreen" => 0x9acd32, - "forestgreen" => 0x228b22, - "olivedrab" => 0x6b8e23, - "darkkhaki" => 0xbdb76b, - "khaki" => 0xf0e68c, - "palegoldenrod" => 0xeee8aa, - "lightgoldenrodyellow" => 0xfafad2, - "lightyellow" => 0xffffe0, - "yellow" => 0xffff00, - "gold" => 0xffd700, - "lightgoldenrod" => 0xeedd82, - "goldenrod" => 0xdaa520, - "darkgoldenrod" => 0xb8860b, - "rosybrown" => 0xbc8f8f, - "indianred" => 0xcd5c5c, - "saddlebrown" => 0x8b4513, - "sienna" => 0xa0522d, - "peru" => 0xcd853f, - "burlywood" => 0xdeb887, - "beige" => 0xf5f5dc, - "wheat" => 0xf5deb3, - "sandybrown" => 0xf4a460, - "tan" => 0xd2b48c, - "chocolate" => 0xd2691e, - "firebrick" => 0xb22222, - "brown" => 0xa52a2a, - "darksalmon" => 0xe9967a, - "salmon" => 0xfa8072, - "lightsalmon" => 0xffa07a, - "orange" => 0xffa500, - "darkorange" => 0xff8c00, - "coral" => 0xff7f50, - "lightcoral" => 0xf08080, - "tomato" => 0xff6347, - "orangered" => 0xff4500, - "red" => 0xff0000, - "hotpink" => 0xff69b4, - "deeppink" => 0xff1493, - "pink" => 0xffc0cb, - "lightpink" => 0xffb6c1, - "palevioletred" => 0xdb7093, - "maroon" => 0xb03060, - "mediumvioletred" => 0xc71585, - "violetred" => 0xd02090, - "magenta" => 0xff00ff, - "violet" => 0xee82ee, - "plum" => 0xdda0dd, - "orchid" => 0xda70d6, - "mediumorchid" => 0xba55d3, - "darkorchid" => 0x9932cc, - "darkviolet" => 0x9400d3, - "blueviolet" => 0x8a2be2, - "purple" => 0xa020f0, - "mediumpurple" => 0x9370db, - "thistle" => 0xd8bfd8, - "snow1" => 0xfffafa, - "snow2" => 0xeee9e9, - "snow3" => 0xcdc9c9, - "snow4" => 0x8b8989, - "seashell1" => 0xfff5ee, - "seashell2" => 0xeee5de, - "seashell3" => 0xcdc5bf, - "seashell4" => 0x8b8682, - "antiquewhite1" => 0xffefdb, - "antiquewhite2" => 0xeedfcc, - "antiquewhite3" => 0xcdc0b0, - "antiquewhite4" => 0x8b8378, - "bisque1" => 0xffe4c4, - "bisque2" => 0xeed5b7, - "bisque3" => 0xcdb79e, - "bisque4" => 0x8b7d6b, - "peachpuff1" => 0xffdab9, - "peachpuff2" => 0xeecbad, - "peachpuff3" => 0xcdaf95, - "peachpuff4" => 0x8b7765, - "navajowhite1" => 0xffdead, - "navajowhite2" => 0xeecfa1, - "navajowhite3" => 0xcdb38b, - "navajowhite4" => 0x8b795e, - "lemonchiffon1" => 0xfffacd, - "lemonchiffon2" => 0xeee9bf, - "lemonchiffon3" => 0xcdc9a5, - "lemonchiffon4" => 0x8b8970, - "cornsilk1" => 0xfff8dc, - "cornsilk2" => 0xeee8cd, - "cornsilk3" => 0xcdc8b1, - "cornsilk4" => 0x8b8878, - "ivory1" => 0xfffff0, - "ivory2" => 0xeeeee0, - "ivory3" => 0xcdcdc1, - "ivory4" => 0x8b8b83, - "honeydew1" => 0xf0fff0, - "honeydew2" => 0xe0eee0, - "honeydew3" => 0xc1cdc1, - "honeydew4" => 0x838b83, - "lavenderblush1" => 0xfff0f5, - "lavenderblush2" => 0xeee0e5, - "lavenderblush3" => 0xcdc1c5, - "lavenderblush4" => 0x8b8386, - "mistyrose1" => 0xffe4e1, - "mistyrose2" => 0xeed5d2, - "mistyrose3" => 0xcdb7b5, - "mistyrose4" => 0x8b7d7b, - "azure1" => 0xf0ffff, - "azure2" => 0xe0eeee, - "azure3" => 0xc1cdcd, - "azure4" => 0x838b8b, - "slateblue1" => 0x836fff, - "slateblue2" => 0x7a67ee, - "slateblue3" => 0x6959cd, - "slateblue4" => 0x473c8b, - "royalblue1" => 0x4876ff, - "royalblue2" => 0x436eee, - "royalblue3" => 0x3a5fcd, - "royalblue4" => 0x27408b, - "blue1" => 0x0000ff, - "blue2" => 0x0000ee, - "blue3" => 0x0000cd, - "blue4" => 0x00008b, - "dodgerblue1" => 0x1e90ff, - "dodgerblue2" => 0x1c86ee, - "dodgerblue3" => 0x1874cd, - "dodgerblue4" => 0x104e8b, - "steelblue1" => 0x63b8ff, - "steelblue2" => 0x5cacee, - "steelblue3" => 0x4f94cd, - "steelblue4" => 0x36648b, - "deepskyblue1" => 0x00bfff, - "deepskyblue2" => 0x00b2ee, - "deepskyblue3" => 0x009acd, - "deepskyblue4" => 0x00688b, - "skyblue1" => 0x87ceff, - "skyblue2" => 0x7ec0ee, - "skyblue3" => 0x6ca6cd, - "skyblue4" => 0x4a708b, - "lightskyblue1" => 0xb0e2ff, - "lightskyblue2" => 0xa4d3ee, - "lightskyblue3" => 0x8db6cd, - "lightskyblue4" => 0x607b8b, - "slategray1" => 0xc6e2ff, - "slategray2" => 0xb9d3ee, - "slategray3" => 0x9fb6cd, - "slategray4" => 0x6c7b8b, - "slategrey1" => 0xc6e2ff, - "slategrey2" => 0xb9d3ee, - "slategrey3" => 0x9fb6cd, - "slategrey4" => 0x6c7b8b, - "lightsteelblue1" => 0xcae1ff, - "lightsteelblue2" => 0xbcd2ee, - "lightsteelblue3" => 0xa2b5cd, - "lightsteelblue4" => 0x6e7b8b, - "lightblue1" => 0xbfefff, - "lightblue2" => 0xb2dfee, - "lightblue3" => 0x9ac0cd, - "lightblue4" => 0x68838b, - "lightcyan1" => 0xe0ffff, - "lightcyan2" => 0xd1eeee, - "lightcyan3" => 0xb4cdcd, - "lightcyan4" => 0x7a8b8b, - "paleturquoise1" => 0xbbffff, - "paleturquoise2" => 0xaeeeee, - "paleturquoise3" => 0x96cdcd, - "paleturquoise4" => 0x668b8b, - "cadetblue1" => 0x98f5ff, - "cadetblue2" => 0x8ee5ee, - "cadetblue3" => 0x7ac5cd, - "cadetblue4" => 0x53868b, - "turquoise1" => 0x00f5ff, - "turquoise2" => 0x00e5ee, - "turquoise3" => 0x00c5cd, - "turquoise4" => 0x00868b, - "cyan1" => 0x00ffff, - "cyan2" => 0x00eeee, - "cyan3" => 0x00cdcd, - "cyan4" => 0x008b8b, - "darkslategray1" => 0x97ffff, - "darkslategray2" => 0x8deeee, - "darkslategray3" => 0x79cdcd, - "darkslategray4" => 0x528b8b, - "darkslategrey1" => 0x97ffff, - "darkslategrey2" => 0x8deeee, - "darkslategrey3" => 0x79cdcd, - "darkslategrey4" => 0x528b8b, - "aquamarine1" => 0x7fffd4, - "aquamarine2" => 0x76eec6, - "aquamarine3" => 0x66cdaa, - "aquamarine4" => 0x458b74, - "darkseagreen1" => 0xc1ffc1, - "darkseagreen2" => 0xb4eeb4, - "darkseagreen3" => 0x9bcd9b, - "darkseagreen4" => 0x698b69, - "seagreen1" => 0x54ff9f, - "seagreen2" => 0x4eee94, - "seagreen3" => 0x43cd80, - "seagreen4" => 0x2e8b57, - "palegreen1" => 0x9aff9a, - "palegreen2" => 0x90ee90, - "palegreen3" => 0x7ccd7c, - "palegreen4" => 0x548b54, - "springgreen1" => 0x00ff7f, - "springgreen2" => 0x00ee76, - "springgreen3" => 0x00cd66, - "springgreen4" => 0x008b45, - "green1" => 0x00ff00, - "green2" => 0x00ee00, - "green3" => 0x00cd00, - "green4" => 0x008b00, - "chartreuse1" => 0x7fff00, - "chartreuse2" => 0x76ee00, - "chartreuse3" => 0x66cd00, - "chartreuse4" => 0x458b00, - "olivedrab1" => 0xc0ff3e, - "olivedrab2" => 0xb3ee3a, - "olivedrab3" => 0x9acd32, - "olivedrab4" => 0x698b22, - "darkolivegreen1" => 0xcaff70, - "darkolivegreen2" => 0xbcee68, - "darkolivegreen3" => 0xa2cd5a, - "darkolivegreen4" => 0x6e8b3d, - "khaki1" => 0xfff68f, - "khaki2" => 0xeee685, - "khaki3" => 0xcdc673, - "khaki4" => 0x8b864e, - "lightgoldenrod1" => 0xffec8b, - "lightgoldenrod2" => 0xeedc82, - "lightgoldenrod3" => 0xcdbe70, - "lightgoldenrod4" => 0x8b814c, - "lightyellow1" => 0xffffe0, - "lightyellow2" => 0xeeeed1, - "lightyellow3" => 0xcdcdb4, - "lightyellow4" => 0x8b8b7a, - "yellow1" => 0xffff00, - "yellow2" => 0xeeee00, - "yellow3" => 0xcdcd00, - "yellow4" => 0x8b8b00, - "gold1" => 0xffd700, - "gold2" => 0xeec900, - "gold3" => 0xcdad00, - "gold4" => 0x8b7500, - "goldenrod1" => 0xffc125, - "goldenrod2" => 0xeeb422, - "goldenrod3" => 0xcd9b1d, - "goldenrod4" => 0x8b6914, - "darkgoldenrod1" => 0xffb90f, - "darkgoldenrod2" => 0xeead0e, - "darkgoldenrod3" => 0xcd950c, - "darkgoldenrod4" => 0x8b6508, - "rosybrown1" => 0xffc1c1, - "rosybrown2" => 0xeeb4b4, - "rosybrown3" => 0xcd9b9b, - "rosybrown4" => 0x8b6969, - "indianred1" => 0xff6a6a, - "indianred2" => 0xee6363, - "indianred3" => 0xcd5555, - "indianred4" => 0x8b3a3a, - "sienna1" => 0xff8247, - "sienna2" => 0xee7942, - "sienna3" => 0xcd6839, - "sienna4" => 0x8b4726, - "burlywood1" => 0xffd39b, - "burlywood2" => 0xeec591, - "burlywood3" => 0xcdaa7d, - "burlywood4" => 0x8b7355, - "wheat1" => 0xffe7ba, - "wheat2" => 0xeed8ae, - "wheat3" => 0xcdba96, - "wheat4" => 0x8b7e66, - "tan1" => 0xffa54f, - "tan2" => 0xee9a49, - "tan3" => 0xcd853f, - "tan4" => 0x8b5a2b, - "chocolate1" => 0xff7f24, - "chocolate2" => 0xee7621, - "chocolate3" => 0xcd661d, - "chocolate4" => 0x8b4513, - "firebrick1" => 0xff3030, - "firebrick2" => 0xee2c2c, - "firebrick3" => 0xcd2626, - "firebrick4" => 0x8b1a1a, - "brown1" => 0xff4040, - "brown2" => 0xee3b3b, - "brown3" => 0xcd3333, - "brown4" => 0x8b2323, - "salmon1" => 0xff8c69, - "salmon2" => 0xee8262, - "salmon3" => 0xcd7054, - "salmon4" => 0x8b4c39, - "lightsalmon1" => 0xffa07a, - "lightsalmon2" => 0xee9572, - "lightsalmon3" => 0xcd8162, - "lightsalmon4" => 0x8b5742, - "orange1" => 0xffa500, - "orange2" => 0xee9a00, - "orange3" => 0xcd8500, - "orange4" => 0x8b5a00, - "darkorange1" => 0xff7f00, - "darkorange2" => 0xee7600, - "darkorange3" => 0xcd6600, - "darkorange4" => 0x8b4500, - "coral1" => 0xff7256, - "coral2" => 0xee6a50, - "coral3" => 0xcd5b45, - "coral4" => 0x8b3e2f, - "tomato1" => 0xff6347, - "tomato2" => 0xee5c42, - "tomato3" => 0xcd4f39, - "tomato4" => 0x8b3626, - "orangered1" => 0xff4500, - "orangered2" => 0xee4000, - "orangered3" => 0xcd3700, - "orangered4" => 0x8b2500, - "red1" => 0xff0000, - "red2" => 0xee0000, - "red3" => 0xcd0000, - "red4" => 0x8b0000, - "deeppink1" => 0xff1493, - "deeppink2" => 0xee1289, - "deeppink3" => 0xcd1076, - "deeppink4" => 0x8b0a50, - "hotpink1" => 0xff6eb4, - "hotpink2" => 0xee6aa7, - "hotpink3" => 0xcd6090, - "hotpink4" => 0x8b3a62, - "pink1" => 0xffb5c5, - "pink2" => 0xeea9b8, - "pink3" => 0xcd919e, - "pink4" => 0x8b636c, - "lightpink1" => 0xffaeb9, - "lightpink2" => 0xeea2ad, - "lightpink3" => 0xcd8c95, - "lightpink4" => 0x8b5f65, - "palevioletred1" => 0xff82ab, - "palevioletred2" => 0xee799f, - "palevioletred3" => 0xcd6889, - "palevioletred4" => 0x8b475d, - "maroon1" => 0xff34b3, - "maroon2" => 0xee30a7, - "maroon3" => 0xcd2990, - "maroon4" => 0x8b1c62, - "violetred1" => 0xff3e96, - "violetred2" => 0xee3a8c, - "violetred3" => 0xcd3278, - "violetred4" => 0x8b2252, - "magenta1" => 0xff00ff, - "magenta2" => 0xee00ee, - "magenta3" => 0xcd00cd, - "magenta4" => 0x8b008b, - "orchid1" => 0xff83fa, - "orchid2" => 0xee7ae9, - "orchid3" => 0xcd69c9, - "orchid4" => 0x8b4789, - "plum1" => 0xffbbff, - "plum2" => 0xeeaeee, - "plum3" => 0xcd96cd, - "plum4" => 0x8b668b, - "mediumorchid1" => 0xe066ff, - "mediumorchid2" => 0xd15fee, - "mediumorchid3" => 0xb452cd, - "mediumorchid4" => 0x7a378b, - "darkorchid1" => 0xbf3eff, - "darkorchid2" => 0xb23aee, - "darkorchid3" => 0x9a32cd, - "darkorchid4" => 0x68228b, - "purple1" => 0x9b30ff, - "purple2" => 0x912cee, - "purple3" => 0x7d26cd, - "purple4" => 0x551a8b, - "mediumpurple1" => 0xab82ff, - "mediumpurple2" => 0x9f79ee, - "mediumpurple3" => 0x8968cd, - "mediumpurple4" => 0x5d478b, - "thistle1" => 0xffe1ff, - "thistle2" => 0xeed2ee, - "thistle3" => 0xcdb5cd, - "thistle4" => 0x8b7b8b, - "gray0" => 0x000000, - "gray1" => 0x030303, - "gray2" => 0x050505, - "gray3" => 0x080808, - "gray4" => 0x0a0a0a, - "gray5" => 0x0d0d0d, - "gray6" => 0x0f0f0f, - "gray7" => 0x121212, - "gray8" => 0x141414, - "gray9" => 0x171717, - "gray10" => 0x1a1a1a, - "gray11" => 0x1c1c1c, - "gray12" => 0x1f1f1f, - "gray13" => 0x212121, - "gray14" => 0x242424, - "gray15" => 0x262626, - "gray16" => 0x292929, - "gray17" => 0x2b2b2b, - "gray18" => 0x2e2e2e, - "gray19" => 0x303030, - "gray20" => 0x333333, - "gray21" => 0x363636, - "gray22" => 0x383838, - "gray23" => 0x3b3b3b, - "gray24" => 0x3d3d3d, - "gray25" => 0x404040, - "gray26" => 0x424242, - "gray27" => 0x454545, - "gray28" => 0x474747, - "gray29" => 0x4a4a4a, - "gray30" => 0x4d4d4d, - "gray31" => 0x4f4f4f, - "gray32" => 0x525252, - "gray33" => 0x545454, - "gray34" => 0x575757, - "gray35" => 0x595959, - "gray36" => 0x5c5c5c, - "gray37" => 0x5e5e5e, - "gray38" => 0x616161, - "gray39" => 0x636363, - "gray40" => 0x666666, - "gray41" => 0x696969, - "gray42" => 0x6b6b6b, - "gray43" => 0x6e6e6e, - "gray44" => 0x707070, - "gray45" => 0x737373, - "gray46" => 0x757575, - "gray47" => 0x787878, - "gray48" => 0x7a7a7a, - "gray49" => 0x7d7d7d, - "gray50" => 0x7f7f7f, - "gray51" => 0x828282, - "gray52" => 0x858585, - "gray53" => 0x878787, - "gray54" => 0x8a8a8a, - "gray55" => 0x8c8c8c, - "gray56" => 0x8f8f8f, - "gray57" => 0x919191, - "gray58" => 0x949494, - "gray59" => 0x969696, - "gray60" => 0x999999, - "gray61" => 0x9c9c9c, - "gray62" => 0x9e9e9e, - "gray63" => 0xa1a1a1, - "gray64" => 0xa3a3a3, - "gray65" => 0xa6a6a6, - "gray66" => 0xa8a8a8, - "gray67" => 0xababab, - "gray68" => 0xadadad, - "gray69" => 0xb0b0b0, - "gray70" => 0xb3b3b3, - "gray71" => 0xb5b5b5, - "gray72" => 0xb8b8b8, - "gray73" => 0xbababa, - "gray74" => 0xbdbdbd, - "gray75" => 0xbfbfbf, - "gray76" => 0xc2c2c2, - "gray77" => 0xc4c4c4, - "gray78" => 0xc7c7c7, - "gray79" => 0xc9c9c9, - "gray80" => 0xcccccc, - "gray81" => 0xcfcfcf, - "gray82" => 0xd1d1d1, - "gray83" => 0xd4d4d4, - "gray84" => 0xd6d6d6, - "gray85" => 0xd9d9d9, - "gray86" => 0xdbdbdb, - "gray87" => 0xdedede, - "gray88" => 0xe0e0e0, - "gray89" => 0xe3e3e3, - "gray90" => 0xe5e5e5, - "gray91" => 0xe8e8e8, - "gray92" => 0xebebeb, - "gray93" => 0xededed, - "gray94" => 0xf0f0f0, - "gray95" => 0xf2f2f2, - "gray96" => 0xf5f5f5, - "gray97" => 0xf7f7f7, - "gray98" => 0xfafafa, - "gray99" => 0xfcfcfc, - "gray100" => 0xffffff, - "grey0" => 0x000000, - "grey1" => 0x030303, - "grey2" => 0x050505, - "grey3" => 0x080808, - "grey4" => 0x0a0a0a, - "grey5" => 0x0d0d0d, - "grey6" => 0x0f0f0f, - "grey7" => 0x121212, - "grey8" => 0x141414, - "grey9" => 0x171717, - "grey10" => 0x1a1a1a, - "grey11" => 0x1c1c1c, - "grey12" => 0x1f1f1f, - "grey13" => 0x212121, - "grey14" => 0x242424, - "grey15" => 0x262626, - "grey16" => 0x292929, - "grey17" => 0x2b2b2b, - "grey18" => 0x2e2e2e, - "grey19" => 0x303030, - "grey20" => 0x333333, - "grey21" => 0x363636, - "grey22" => 0x383838, - "grey23" => 0x3b3b3b, - "grey24" => 0x3d3d3d, - "grey25" => 0x404040, - "grey26" => 0x424242, - "grey27" => 0x454545, - "grey28" => 0x474747, - "grey29" => 0x4a4a4a, - "grey30" => 0x4d4d4d, - "grey31" => 0x4f4f4f, - "grey32" => 0x525252, - "grey33" => 0x545454, - "grey34" => 0x575757, - "grey35" => 0x595959, - "grey36" => 0x5c5c5c, - "grey37" => 0x5e5e5e, - "grey38" => 0x616161, - "grey39" => 0x636363, - "grey40" => 0x666666, - "grey41" => 0x696969, - "grey42" => 0x6b6b6b, - "grey43" => 0x6e6e6e, - "grey44" => 0x707070, - "grey45" => 0x737373, - "grey46" => 0x757575, - "grey47" => 0x787878, - "grey48" => 0x7a7a7a, - "grey49" => 0x7d7d7d, - "grey50" => 0x7f7f7f, - "grey51" => 0x828282, - "grey52" => 0x858585, - "grey53" => 0x878787, - "grey54" => 0x8a8a8a, - "grey55" => 0x8c8c8c, - "grey56" => 0x8f8f8f, - "grey57" => 0x919191, - "grey58" => 0x949494, - "grey59" => 0x969696, - "grey60" => 0x999999, - "grey61" => 0x9c9c9c, - "grey62" => 0x9e9e9e, - "grey63" => 0xa1a1a1, - "grey64" => 0xa3a3a3, - "grey65" => 0xa6a6a6, - "grey66" => 0xa8a8a8, - "grey67" => 0xababab, - "grey68" => 0xadadad, - "grey69" => 0xb0b0b0, - "grey70" => 0xb3b3b3, - "grey71" => 0xb5b5b5, - "grey72" => 0xb8b8b8, - "grey73" => 0xbababa, - "grey74" => 0xbdbdbd, - "grey75" => 0xbfbfbf, - "grey76" => 0xc2c2c2, - "grey77" => 0xc4c4c4, - "grey78" => 0xc7c7c7, - "grey79" => 0xc9c9c9, - "grey80" => 0xcccccc, - "grey81" => 0xcfcfcf, - "grey82" => 0xd1d1d1, - "grey83" => 0xd4d4d4, - "grey84" => 0xd6d6d6, - "grey85" => 0xd9d9d9, - "grey86" => 0xdbdbdb, - "grey87" => 0xdedede, - "grey88" => 0xe0e0e0, - "grey89" => 0xe3e3e3, - "grey90" => 0xe5e5e5, - "grey91" => 0xe8e8e8, - "grey92" => 0xebebeb, - "grey93" => 0xededed, - "grey94" => 0xf0f0f0, - "grey95" => 0xf2f2f2, - "grey96" => 0xf5f5f5, - "grey97" => 0xf7f7f7, - "grey98" => 0xfafafa, - "grey99" => 0xfcfcfc, - "grey100" => 0xffffff, - "darkgrey" => 0xa9a9a9, - "darkgray" => 0xa9a9a9, - "darkblue" => 0x00008b, - "darkcyan" => 0x008b8b, - "darkmagenta" => 0x8b008b, - "darkred" => 0x8b0000, - "lightgreen" => 0x90ee90, - }; -} +This is free software, licensed under: -1; - -__END__ + The Artistic License 2.0 (GPL Compatible) +=cut diff --git a/t/rgb.txt b/t-etc/rgb.txt index 72fb6f2..72fb6f2 100755 --- a/t/rgb.txt +++ b/t-etc/rgb.txt diff --git a/t/00-report-prereqs.dd b/t/00-report-prereqs.dd new file mode 100644 index 0000000..a03253e --- /dev/null +++ b/t/00-report-prereqs.dd @@ -0,0 +1,48 @@ +do { my $x = { + 'configure' => { + 'requires' => { + 'ExtUtils::MakeMaker' => '0' + } + }, + 'develop' => { + 'requires' => { + 'Test::EOF' => '0', + 'Test::EOL' => '0', + 'Test::MinimumVersion' => '0', + 'Test::More' => '0.88', + 'Test::NoTabs' => '0', + 'Test::Pod' => '1.41', + 'Test::Pod::LinkCheck' => '0', + 'Test::Portability::Files' => '0', + 'Test::TrailingSpace' => '0.0203' + } + }, + 'runtime' => { + 'requires' => { + 'Exporter' => '5.57', + 'Module::Load' => '0.10', + 'Module::Loaded' => '0', + 'perl' => 'v5.10.0', + 'version' => '0' + } + }, + 'test' => { + 'recommends' => { + 'CPAN::Meta' => '2.120900' + }, + 'requires' => { + 'File::Spec' => '0', + 'FileHandle' => '0', + 'IO::File' => '0', + 'Module::Metadata' => '0', + 'Test::Exception' => '0', + 'Test::More' => '0', + 'Test::Most' => '0', + 'constant' => '0', + 'lib' => '0', + 'perl' => 'v5.10.0' + } + } + }; + $x; + }
\ No newline at end of file diff --git a/t/00-report-prereqs.t b/t/00-report-prereqs.t new file mode 100644 index 0000000..a208406 --- /dev/null +++ b/t/00-report-prereqs.t @@ -0,0 +1,193 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 + +use Test::More tests => 1; + +use Module::Metadata; +use File::Spec; + +# from $version::LAX +my $lax_version_re = + qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? + | + (?:\.[0-9]+) (?:_[0-9]+)? + ) | (?: + v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? + | + (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? + ) + )/x; + +# hide optional CPAN::Meta modules from prereq scanner +# and check if they are available +my $cpan_meta = "CPAN::Meta"; +my $cpan_meta_pre = "CPAN::Meta::Prereqs"; +my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic + +# Verify requirements? +my $DO_VERIFY_PREREQS = 1; + +sub _max { + my $max = shift; + $max = ( $_ > $max ) ? $_ : $max for @_; + return $max; +} + +sub _merge_prereqs { + my ($collector, $prereqs) = @_; + + # CPAN::Meta::Prereqs object + if (ref $collector eq $cpan_meta_pre) { + return $collector->with_merged_prereqs( + CPAN::Meta::Prereqs->new( $prereqs ) + ); + } + + # Raw hashrefs + for my $phase ( keys %$prereqs ) { + for my $type ( keys %{ $prereqs->{$phase} } ) { + for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { + $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; + } + } + } + + return $collector; +} + +my @include = qw( + +); + +my @exclude = qw( + +); + +# Add static prereqs to the included modules list +my $static_prereqs = do './t/00-report-prereqs.dd'; + +# Merge all prereqs (either with ::Prereqs or a hashref) +my $full_prereqs = _merge_prereqs( + ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), + $static_prereqs +); + +# Add dynamic prereqs to the included modules list (if we can) +my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; +my $cpan_meta_error; +if ( $source && $HAS_CPAN_META + && (my $meta = eval { CPAN::Meta->load_file($source) } ) +) { + $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); +} +else { + $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) + $source = 'static metadata'; +} + +my @full_reports; +my @dep_errors; +my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; + +# Add static includes into a fake section +for my $mod (@include) { + $req_hash->{other}{modules}{$mod} = 0; +} + +for my $phase ( qw(configure build test runtime develop other) ) { + next unless $req_hash->{$phase}; + next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); + + for my $type ( qw(requires recommends suggests conflicts modules) ) { + next unless $req_hash->{$phase}{$type}; + + my $title = ucfirst($phase).' '.ucfirst($type); + my @reports = [qw/Module Want Have/]; + + for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { + next if $mod eq 'perl'; + next if grep { $_ eq $mod } @exclude; + + my $file = $mod; + $file =~ s{::}{/}g; + $file .= ".pm"; + my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; + + my $want = $req_hash->{$phase}{$type}{$mod}; + $want = "undef" unless defined $want; + $want = "any" if !$want && $want == 0; + + my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; + + if ($prefix) { + my $have = Module::Metadata->new_from_file( File::Spec->catfile($prefix, $file) )->version; + $have = "undef" unless defined $have; + push @reports, [$mod, $want, $have]; + + if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { + if ( $have !~ /\A$lax_version_re\z/ ) { + push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; + } + elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { + push @dep_errors, "$mod version '$have' is not in required range '$want'"; + } + } + } + else { + push @reports, [$mod, $want, "missing"]; + + if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { + push @dep_errors, "$mod is not installed ($req_string)"; + } + } + } + + if ( @reports ) { + push @full_reports, "=== $title ===\n\n"; + + my $ml = _max( map { length $_->[0] } @reports ); + my $wl = _max( map { length $_->[1] } @reports ); + my $hl = _max( map { length $_->[2] } @reports ); + + if ($type eq 'modules') { + splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; + push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; + } + else { + splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; + push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; + } + + push @full_reports, "\n"; + } + } +} + +if ( @full_reports ) { + diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; +} + +if ( $cpan_meta_error || @dep_errors ) { + diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; +} + +if ( $cpan_meta_error ) { + my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; + diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; +} + +if ( @dep_errors ) { + diag join("\n", + "\nThe following REQUIRED prerequisites were not satisfied:\n", + @dep_errors, + "\n" + ); +} + +pass; + +# vim: ts=4 sts=4 sw=4 et: diff --git a/t/01-ColorNames.t b/t/01-ColorNames.t deleted file mode 100644 index 5d5bad5..0000000 --- a/t/01-ColorNames.t +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/perl
-
-use strict;
-
-use Test::More tests => 54;
-use Test::Exception;
-
-use_ok('Graphics::ColorNames', '2.10', qw( hex2tuple tuple2hex all_schemes ));
-
-{
- my %schemes = map { $_=>1, } all_schemes();
- ok((keys %schemes) >= 4); # Windows, Netscape, HTML, and X
- ok($schemes{X});
- ok($schemes{HTML});
- ok($schemes{Windows});
- ok($schemes{Netscape});
-}
-
-tie my %colors, 'Graphics::ColorNames';
-ok(tied %colors);
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple($colors{$name});
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
-
-$count = 0;
-foreach my $name (keys %colors)
- {
- $count++, if ($colors{lc($name)} eq $colors{uc($name)});
- }
-ok($count == keys %colors);
-
-
-$count = 0;
-foreach my $name (keys %colors)
- {
- $count++, if (exists($colors{$name}))
- }
-ok($count == keys %colors);
-
-$count = 0;
-foreach my $name (keys %colors)
- {
- my $rgb = $colors{$name};
- $count++, if (defined $colors{$rgb});
- $count++, if (defined $colors{"\x23".$rgb});
- }
-ok($count == (2*(keys %colors)));
-
-# Test CLEAR, DELETE and STORE as returning errors
-
-dies_ok { undef %colors } "undef %colors";
-
-dies_ok { %colors = (); } "%colors = ()";
-
-dies_ok { $colors{MyCustomColor} = 'FFFFFF'; } "STORE";
-
-dies_ok { delete($colors{MyCustomColor}); } "DELETE";
-
-# Test RGB values being passed through
-
-foreach my $rgb (qw(
- 000000 000001 000010 000100 001000 010000 100000
- 111111 123abc abc123 123ABC ABC123 abcdef ABCDEF
- )) {
- ok($colors{ "\x23" . $rgb } eq lc($rgb));
- ok($colors{ $rgb } eq lc($rgb));
-}
-
-# Test using multiple schemes, with issues in overlapping
-
-tie my %colors2, 'Graphics::ColorNames', qw( X Netscape );
-
-ok(!exists $colors{Silver}); # Silver doesn't exist in X
-ok(defined $colors2{Silver}); # It does in Netscape
-
-# Test precedence
-
-ok($colors{DarkGreen} eq '006400'); # DarkGreen in X
-ok($colors2{DarkGreen} eq '006400'); # DarkGreen in X
-ok($colors2{DarkGreen} ne '2f4f2f'); # DarkGreen in Netscape
-
-tie my %colors3, 'Graphics::ColorNames', qw( Netscape X );
-
-ok($colors{Brown} eq 'a52a2a'); # Brown in X
-ok($colors2{Brown} eq 'a52a2a'); # Brown in X (don't try Netscape)
-ok($colors3{Brown} eq 'a62a2a'); # Brown in Netscape (don't try X)
-
-# Test handling of non-existent color names
-
-ok(!defined $colors{NonExistentColorName});
-ok(!exists $colors{NonExistentColorName});
-
-# Test dynamic loading of scheme
-
-my $colorobj = tied(%colors);
-$colorobj->load_scheme({ nonexistentcolorname => 0x123456 } );
-ok($colors{NonExistentColorName} eq '123456');
-
-
-
diff --git a/t/01-exports.t b/t/01-exports.t new file mode 100644 index 0000000..d549469 --- /dev/null +++ b/t/01-exports.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use Test::Most; + +use lib 't/lib'; + +use_ok( 'Graphics::ColorNames', qw/ all_schemes hex2tuple tuple2hex / ); + +ok my @schemes = all_schemes(), 'all_schemes'; + +cmp_deeply( \@schemes, supersetof(qw/ X Test /), 'minimum set of schemes' ); + +is_deeply [ hex2tuple('010203') ], [ 1, 2, 3 ], 'hex2tuple'; + +is_deeply [ hex2tuple('ffeedd') ], [ 255, 238, 221 ], 'hex2tuple'; + +is tuple2hex( 1, 2, 3 ) => '010203', 'tuple2hex'; + +is tuple2hex( 255, 238, 221 ) => 'ffeedd', 'tuple2hex'; + +done_testing; diff --git a/t/01-version.t b/t/01-version.t deleted file mode 100644 index ac2a11c..0000000 --- a/t/01-version.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Test::More tests => 5; - -use_ok("Graphics::ColorNames"); - -my @Modules = (qw( X HTML Windows Netscape)); - -foreach my $mod (@Modules) { - use_ok("Graphics::ColorNames::$mod", $Graphics::ColorNames::VERSION); -} - @@ -1,28 +1,27 @@ -#!/usr/bin/perl
-
-use strict;
-
-use Test::More tests => 19;
-
-use_ok('Graphics::ColorNames', 2.1002, qw( hex2tuple tuple2hex ));
-
-tie my %colors, 'Graphics::ColorNames', 'X';
-ok(tied %colors);
-
-ok(keys %colors == 665); #
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
-
-foreach my $ad (qw( royal dodger slate sky steel )) {
- foreach my $col (qw( blue )) {
- ok(exists $colors{"$ad$col"});
- ok($colors{"$ad$col"} eq $colors{"$ad $col"}, "$ad $col");
- ok($colors{"$ad-$col"} eq $colors{"$ad $col"}, "$ad $col");
- }
-}
+#!/usr/bin/perl + +use strict; + +use Test::More tests => 19; + +use_ok( 'Graphics::ColorNames', 2.1002, qw( hex2tuple tuple2hex ) ); + +tie my %colors, 'Graphics::ColorNames', 'X'; +ok( tied %colors ); + +is( scalar(keys %colors), 676 ); # + +my $count = 0; +foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); +} +ok( $count == keys %colors ); + +foreach my $ad (qw( royal dodger slate sky steel )) { + foreach my $col (qw( blue )) { + ok( exists $colors{"$ad$col"} ); + ok( $colors{"$ad$col"} eq $colors{"$ad $col"}, "$ad $col" ); + ok( $colors{"$ad-$col"} eq $colors{"$ad $col"}, "$ad $col" ); + } +} diff --git a/t/03-HTML.t b/t/03-HTML.t deleted file mode 100644 index f59d6dd..0000000 --- a/t/03-HTML.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl
-
-use strict;
-use Test::More tests => 7;
-
-use_ok('Graphics::ColorNames', 1.06, qw( hex2tuple tuple2hex ));
-
-tie my %colors, 'Graphics::ColorNames', 'HTML';
-ok(tied %colors);
-
-ok(keys %colors == 17);
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
-
-ok(exists($colors{"fuchsia"}));
-ok(exists($colors{"fuscia"}));
-ok($colors{"fuscia"} eq $colors{"fuchsia"});
diff --git a/t/03-oo.t b/t/03-oo.t new file mode 100644 index 0000000..2d04fb0 --- /dev/null +++ b/t/03-oo.t @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +use Test::Most; + +use lib 't/lib'; + +use_ok('Graphics::ColorNames'); + +my $s = Graphics::ColorNames->new; +isa_ok $s, 'Graphics::ColorNames'; + +subtest 'hex' => sub { + + is $s->hex('darkgreen'), '006400', 'darkgreen'; + is $s->hex('Dark Green'), '006400', 'Dark Green'; + is $s->hex('Dark-Green'), '006400', 'Dark-Green'; + is $s->hex('Dark_Green'), '006400', 'Dark-Green'; + + is $s->hex( 'darkgreen', '#' ), '#006400', 'darkgreen (prefix)'; + is $s->hex( 'darkgreen', '0x' ), '0x006400', 'darkgreen (prefix)'; + + is $s->hex('dorkreen'), '', 'nonexistenct color'; + is $s->hex( 'dorkreen', '#' ), '', 'nonexistenct color with prefix'; + + is $s->hex('123abc') => '123abc', 'passthru'; + is $s->hex('#123abc') => '123abc', 'passthru (# prefix)'; + is $s->hex('0x123abc') => '123abc', 'passthru (0x prefix)'; + +}; + +subtest 'rgb' => sub { + + is_deeply [ $s->rgb('darkgreen') ], [ 0, 0x64, 0 ], 'darkgreen'; + is_deeply [ $s->rgb('DarkGreen') ], [ 0, 0x64, 0 ], 'DarkGreen'; + is_deeply [ $s->rgb('Dark-Green') ], [ 0, 0x64, 0 ], 'Dark-Green'; + is_deeply [ $s->rgb('Dark_Green') ], [ 0, 0x64, 0 ], 'Dark_Green'; + + is_deeply [ $s->rgb( 'darkgreen', ',' ) ], [ 0, 0x64, 0 ], + 'darkgreen (separator ignored in list context)'; + + is $s->rgb('darkgreen'), "0,100,0", 'darkgreen (scalar)'; + is $s->rgb( 'darkgreen', ' ' ), "0 100 0", + 'darkgreen (scalar with separator)'; + + is_deeply [ $s->rgb('dorkreen') ], [], 'nonexistent color'; + is $s->rgb('dorkreen'), '', 'nonexistent color (scalar context)'; + is $s->rgb( 'dorkreen', ' ' ), '', + 'nonexistent color (scalar context with separator)'; + + is_deeply [ $s->rgb('123abc') ] => [ 18, 58, 188 ], + 'passthru (list context)'; + is $s->rgb('123abc') => '18,58,188', 'passthru'; + is $s->rgb( '123abc', ' ' ) => '18 58 188', 'passthru (with separator)'; + is $s->rgb('#123abc') => '18,58,188', 'passthru (# prefix)'; + is $s->rgb('0x123abc') => '18,58,188', 'passthru (0x prefix)'; + +}; + +subtest 'load_scheme' => sub { + + is $s->hex('nonexistentcolorname') => '', 'unknown color'; + + ok $s->load_scheme( { nonexistentcolorname => 0x123456 } ), 'load_scheme'; + + is $s->hex('nonexistentcolorname') => '123456', 'loaded color'; + +}; + +subtest 'autoloading removed' => sub { + + ok $s->rgb('darkgreen'), 'has darkgreen color'; + + ok !$s->can('darkgreen'), 'no darkgreen method'; + +}; + +done_testing; diff --git a/t/04-Windows.t b/t/04-Windows.t deleted file mode 100644 index 870c19c..0000000 --- a/t/04-Windows.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/buin/perl
-
-use strict;
-
-use Test::More tests => 4;
-
-use_ok('Graphics::ColorNames', 1.06, qw( hex2tuple tuple2hex ));
-
-tie my %colors, 'Graphics::ColorNames', 'Windows';
-ok(tied %colors);
-
-ok(keys %colors == 16);
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
diff --git a/t/04-precedence.t b/t/04-precedence.t new file mode 100644 index 0000000..d7aa10b --- /dev/null +++ b/t/04-precedence.t @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use Test::Most; + +use lib 't/lib'; + +use_ok( 'Graphics::ColorNames' ); + +my $sxw = Graphics::ColorNames->new( qw/ X Test / ); +isa_ok $sxw, 'Graphics::ColorNames'; + +is $sxw->hex('darkgreen'), '006400', 'DarkGreen (X)'; + +my $swx = Graphics::ColorNames->new( qw/ Test X / ); +isa_ok $swx, 'Graphics::ColorNames'; + +is $swx->hex('darkgreen'), '008000', 'DarkGreen (Test)'; + +done_testing; diff --git a/t/05-Netscape.t b/t/05-Netscape.t deleted file mode 100644 index b08ebd9..0000000 --- a/t/05-Netscape.t +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl
-
-use strict;
-
-use Test::More tests => 9;
-
-use_ok('Graphics::ColorNames', 2.10, qw( hex2tuple tuple2hex ));
-
-tie my %colors, 'Graphics::ColorNames', 'Netscape';
-ok(tied %colors);
-
-ok(keys %colors == 100); #
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
-
-# Problem is with Netscape's color definitions
-
-{
- # local $TODO = "Problem with Netscape color definitions";
- ok($colors{gold} ne $colors{mediumblue});
- ok($colors{lightblue} ne $colors{mediumblue});
- ok($colors{lightblue} ne $colors{gold});
-}
-
-ok($colors{"semisweetchocolate"} eq $colors{"semi-sweetchocolate"});
-ok($colors{"baker\'schocolate"} eq $colors{"bakerschocolate"});
diff --git a/t/05-tied.t b/t/05-tied.t new file mode 100644 index 0000000..cc11312 --- /dev/null +++ b/t/05-tied.t @@ -0,0 +1,80 @@ +#!/usr/bin/perl + +use Test::Most; + +use lib 't/lib'; + +use_ok( 'Graphics::ColorNames', '3.3', qw( hex2tuple tuple2hex ) ); + +tie my %colors, 'Graphics::ColorNames'; +ok( tied %colors ); + +my $count = 0; +foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); +} +ok( $count == keys %colors ); + +$count = 0; +foreach my $name ( keys %colors ) { + $count++, if ( $colors{ lc($name) } eq $colors{ uc($name) } ); +} +ok( $count == keys %colors ); + +$count = 0; +foreach my $name ( keys %colors ) { + $count++, if ( exists( $colors{$name} ) ); +} +ok( $count == keys %colors ); + +$count = 0; +foreach my $name ( keys %colors ) { + my $rgb = $colors{$name}; + $count++, if ( defined $colors{$rgb} ); + $count++, if ( defined $colors{ "\x23" . $rgb } ); +} +ok( $count == ( 2 * ( keys %colors ) ) ); + +# Test CLEAR, DELETE and STORE as returning errors + +dies_ok { undef %colors } "undef %colors"; + +dies_ok { %colors = (); } "%colors = ()"; + +dies_ok { $colors{MyCustomColor} = 'FFFFFF'; } "STORE"; + +dies_ok { delete( $colors{MyCustomColor} ); } "DELETE"; + +# Test RGB values being passed through + +foreach my $rgb ( + qw( + 000000 000001 000010 000100 001000 010000 100000 + 111111 123abc abc123 123ABC ABC123 abcdef ABCDEF + ) + ) +{ + ok( $colors{ "\x23" . $rgb } eq lc($rgb) ); + ok( $colors{ "0x" . $rgb } eq lc($rgb) ); + ok( $colors{$rgb} eq lc($rgb) ); +} + +# Test using multiple schemes, with issues in overlapping + +tie my %colors3, 'Graphics::ColorNames', qw( X Test ); + +tie my %colors4, 'Graphics::ColorNames', qw( Test X ); + +# Test precedence + +ok( $colors{DarkGreen} eq '006400' ); # DarkGreen in X +ok( $colors3{DarkGreen} eq '006400' ); # DarkGreen in X +ok( $colors4{DarkGreen} eq '008000' ); # DarkGreen in Test + +# Test handling of non-existent color names + +ok( !defined $colors{NonExistentColorName} ); +ok( !exists $colors{NonExistentColorName} ); + +done_testing; diff --git a/t/06-obj.t b/t/06-obj.t deleted file mode 100644 index a0a8808..0000000 --- a/t/06-obj.t +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/perl
-
-use strict;
-
-use constant TEST_CASES => {
- "black" => 0x000000,
- "red" => 0xff0000,
- "green" => 0x00ff00,
- "blue" => 0x0000ff,
- "white" => 0xffffff,
- # some arbitrary colors added for testing the autoloaded color names
- "lavenderblush" => 0xfff0f5,
- "lavender_blush" => 0xfff0f5,
- "LavenderBlush" => 0xfff0f5,
- "LAVENDERBLUSH" => 0xfff0f5,
-};
-
-use Test::More;
-use Test::Exception;
-
-my $tests = TEST_CASES;
-
-plan tests => 4 + (11 * (keys %$tests));
-
-use_ok('Graphics::ColorNames', 2.1003, (qw(tuple2hex)));
-
-my $rgb = Graphics::ColorNames->new(qw( X ));
-ok(defined $rgb);
-ok($rgb->isa('Graphics::ColorNames'));
-
-{
- # This causes errors
-
- # local $TODO = "AutoLoading non-existent color method";
- dies_ok {
- $rgb->SomeNonExistentColor();
- } "SomeNonExistentColor should have failed";
-
-}
-
-foreach my $name (keys %$tests) {
-
- my $a = $rgb->hex($name, '0x');
- ok( $a =~ /^0x[0-9a-f]{6}$/i );
- ok( eval($a) == $tests->{$name}, "Testing color $name" );
-
- my $b = $rgb->hex($name, '#');
- ok( $b =~ /^\x23[0-9a-f]{6}$/i );
-
- my $c = $rgb->hex($name, "");
- ok( $c =~ /^[0-9a-f]{6}$/i );
-
- $c = $rgb->hex($name);
- ok( $c =~ /^[0-9a-f]{6}$/i );
-
- ok($rgb->$name eq $c);
- {
- local $TODO = "Handle the can() method";
- ok($rgb->can($name));
- }
-
- my $d = $rgb->rgb($name, ',');
- ok( $d =~ /^\d{1,3}(\,\d{1,3}){2}$/ );
-
- my @v = $rgb->rgb($name);
- ok( @v == 3 );
-
- ok( join(',', @v) eq $d );
- ok( tuple2hex(@v) eq $c );
-
-}
-
diff --git a/t/07-file.t b/t/07-file.t index 1bd448c..b2d436d 100644 --- a/t/07-file.t +++ b/t/07-file.t @@ -1,24 +1,38 @@ -#!/usr/bin/perl
-
-use strict;
-
-use Test::More tests => 10;
-
-use_ok('Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ));
-
-tie my %colors, 'Graphics::ColorNames', './t/rgb.txt';
-ok(tied %colors);
-
-ok(keys %colors == 6); #
-
-my $count = 0;
-foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
-ok($count == keys %colors);
-
-foreach my $name (qw( one two three four five six)) {
- ok(exists $colors{$name});
-}
+#!/usr/bin/perl + +use strict; + +use Test::More; +use Test::Exception; + +use File::Spec::Functions qw/ rel2abs /; + +use_ok( 'Graphics::ColorNames', 3.2, qw( hex2tuple tuple2hex ) ); + +my $file = './t-etc/rgb.txt'; + +throws_ok { + tie my %colors, 'Graphics::ColorNames', $file; +} qr/Unknown color scheme/, 'relative pathnames rejected (TIE)'; + +throws_ok { + my $po = Graphics::ColorNames->new($file); +} qr/Unknown color scheme/, 'relative pathnames rejected (OO)'; + +tie my %colors, 'Graphics::ColorNames', rel2abs($file); +ok tied %colors, 'is tied'; + +is scalar(keys %colors), 6, 'expected number of colors'; + +my $count = 0; +foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); +} +ok( $count == keys %colors ); + +foreach my $name (qw( one two three four five six)) { + ok( exists $colors{$name} ); +} + +done_testing; diff --git a/t/08-filehandle.t b/t/08-filehandle.t index fae6f9e..499e564 100644 --- a/t/08-filehandle.t +++ b/t/08-filehandle.t @@ -1,81 +1,77 @@ -#!/usr/bin/perl
-
-use strict;
-use Test::More tests => 28;
-
-use FileHandle;
-use IO::File;
-
-use_ok('Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ));
-
-{
- my $fh = new IO::File;
- open($fh, './t/rgb.txt');
-
-
- tie my %colors, 'Graphics::ColorNames', $fh;
- ok(tied %colors);
-
- ok(keys %colors == 6); #
-
- my $count = 0;
- foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
- ok($count == keys %colors);
-
- foreach my $name (qw( one two three four five six)) {
- ok(exists $colors{$name});
- }
-
- close $fh;
-}
-
-{
- my $fh = new FileHandle;
- open($fh, './t/rgb.txt');
-
- tie my %colors, 'Graphics::ColorNames', $fh;
- ok(tied %colors);
-
- ok(keys %colors == 6); #
-
- my $count = 0;
- foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
- ok($count == keys %colors);
-
- foreach my $name (qw( one two three four five six)) {
- ok(exists $colors{$name});
- }
-
- close $fh;
-}
-
-{
- open(my $fh, './t/rgb.txt');
-
- tie my %colors, 'Graphics::ColorNames', $fh;
- ok(tied %colors);
-
- ok(keys %colors == 6); #
-
- my $count = 0;
- foreach my $name (keys %colors)
- {
- my @RGB = hex2tuple( $colors{$name} );
- $count++, if (tuple2hex(@RGB) eq $colors{$name} );
- }
- ok($count == keys %colors);
-
- foreach my $name (qw( one two three four five six)) {
- ok(exists $colors{$name});
- }
-
- close $fh;
-}
+#!/usr/bin/perl + +use strict; +use Test::More tests => 28; + +use FileHandle; +use IO::File; + +use_ok( 'Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ) ); + +{ + my $fh = new IO::File; + open( $fh, './t-etc/rgb.txt' ); + + tie my %colors, 'Graphics::ColorNames', $fh; + ok( tied %colors ); + + ok( keys %colors == 6 ); # + + my $count = 0; + foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); + } + ok( $count == keys %colors ); + + foreach my $name (qw( one two three four five six)) { + ok( exists $colors{$name} ); + } + + close $fh; +} + +{ + my $fh = new FileHandle; + open( $fh, './t-etc/rgb.txt' ); + + tie my %colors, 'Graphics::ColorNames', $fh; + ok( tied %colors ); + + ok( keys %colors == 6 ); # + + my $count = 0; + foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); + } + ok( $count == keys %colors ); + + foreach my $name (qw( one two three four five six)) { + ok( exists $colors{$name} ); + } + + close $fh; +} + +{ + open( my $fh, './t-etc/rgb.txt' ); + + tie my %colors, 'Graphics::ColorNames', $fh; + ok( tied %colors ); + + ok( keys %colors == 6 ); # + + my $count = 0; + foreach my $name ( keys %colors ) { + my @RGB = hex2tuple( $colors{$name} ); + $count++, if ( tuple2hex(@RGB) eq $colors{$name} ); + } + ok( $count == keys %colors ); + + foreach my $name (qw( one two three four five six)) { + ok( exists $colors{$name} ); + } + + close $fh; +} diff --git a/t/09-colorlibrary.t b/t/09-colorlibrary.t index 5370c1a..53c6f21 100644 --- a/t/09-colorlibrary.t +++ b/t/09-colorlibrary.t @@ -1,37 +1,39 @@ -#!/usr/bin/perl
-
-use strict;
-use Test::More;
-
-eval "use Color::Library 0.02";
-
-plan skip_all => "Color::Library 0.02 required" if $@;
-
-use constant TEST_CASES => {
- "croceus" => 0xf4c2c2,
- "croceus28" => 0xf4c2c2,
- "croceus53" => 0xd99058,
-# "black" => 0x000000,
-# "aqua" => 0x00ffff,
-# "maroon" => 0x800000,
-# "lime" => 0x00ff00,
-};
-
-my $tests = TEST_CASES;
-
-plan tests => 3 + (keys %$tests);
-
-use_ok("Graphics::ColorNames", "2.10002");
-
-use_ok("Color::Library::Dictionary::NBS_ISCC::B");
-
-{
- my $obj = Graphics::ColorNames->new( 'Color::Library::Dictionary::NBS_ISCC::B' );
- ok ($obj->isa("Graphics::ColorNames"));
-
- foreach my $name (keys %$tests) {
- ok($obj->hex($name) eq sprintf('%06x',$tests->{$name}),
- "failed test for color $name");
- }
-
-}
+#!/usr/bin/perl + +use strict; +use Test::More; + +eval "use Color::Library 0.02"; + +plan skip_all => "Color::Library 0.02 required" if $@; + +use constant TEST_CASES => { + "croceus" => 0xf4c2c2, + "croceus28" => 0xf4c2c2, + "croceus53" => 0xd99058, + + # "black" => 0x000000, + # "aqua" => 0x00ffff, + # "maroon" => 0x800000, + # "lime" => 0x00ff00, +}; + +my $tests = TEST_CASES; + +plan tests => 3 + ( keys %$tests ); + +use_ok( "Graphics::ColorNames", "2.10002" ); + +use_ok("Color::Library::Dictionary::NBS_ISCC::B"); + +{ + my $obj = + Graphics::ColorNames->new('Color::Library::Dictionary::NBS_ISCC::B'); + ok( $obj->isa("Graphics::ColorNames") ); + + foreach my $name ( keys %$tests ) { + ok( $obj->hex($name) eq sprintf( '%06x', $tests->{$name} ), + "failed test for color $name" ); + } + +} @@ -1,32 +1,30 @@ -#!/usr/bin/perl
-
-use strict;
-
-use Test::More;
-
-eval "use Tie::Sub";
-
-plan skip_all => "Tie::Sub required" if $@;
-
-plan tests => 4;
-
-use_ok('Graphics::ColorNames', '2.10', qw( all_schemes ));
-
-tie my %colors, 'Graphics::ColorNames';
-
-# Test handling of non-existent color names
-
-ok(!defined $colors{NonExistentColorName});
-ok(!exists $colors{NonExistentColorName});
-
-# Test dynamic loading of scheme
-
-my $colorobj = tied(%colors);
-$colorobj->load_scheme( sub {
- return 0x123456;
- }
-);
-ok($colors{NonExistentColorName} eq '123456');
-
-
-
+#!/usr/bin/perl + +use strict; + +use Test::More; + +eval "use Tie::Sub"; + +plan skip_all => "Tie::Sub required" if $@; + +plan tests => 4; + +use_ok( 'Graphics::ColorNames', '2.10', qw( all_schemes ) ); + +tie my %colors, 'Graphics::ColorNames'; + +# Test handling of non-existent color names + +ok( !defined $colors{NonExistentColorName} ); +ok( !exists $colors{NonExistentColorName} ); + +# Test dynamic loading of scheme + +my $colorobj = tied(%colors); +$colorobj->load_scheme( + sub { + return 0x123456; + } +); +ok( $colors{NonExistentColorName} eq '123456' ); diff --git a/t/90-file-port.t b/t/90-file-port.t deleted file mode 100644 index 36a8fe4..0000000 --- a/t/90-file-port.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl
-
-use Test::More;
-
-plan skip_all => "Enable DEVEL_TESTS environent variable"
- unless ($ENV{DEVEL_TESTS});
-
-eval "use Test::Portability::Files";
-
-plan skip_all => "Test::Portability::Files required for testing filenames portability" if $@;
-
-
-run_tests();
diff --git a/t/90-pod-coverage.t b/t/90-pod-coverage.t deleted file mode 100644 index f533eea..0000000 --- a/t/90-pod-coverage.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Test::More; - -plan skip_all => "Enable DEVEL_TESTS environent variable" - unless ($ENV{DEVEL_TESTS}); - -if (eval "use Test::Pod::Coverage tests => 1") { -} -else { - plan skip_all => "Test::Pod::Coverage required" if $@; -} - -pod_coverage_ok("Graphics::ColorNames"); - - diff --git a/t/90-pod.t b/t/90-pod.t deleted file mode 100644 index cace2ad..0000000 --- a/t/90-pod.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl
-
-use strict;
-use Test::More;
-
-plan skip_all => "Enable DEVEL_TESTS environent variable"
- unless ($ENV{DEVEL_TESTS});
-
-eval "use Test::Pod 1.00";
-
-plan skip_all => "Test::Pod 1.00 required" if $@;
-
-my @poddirs = qw( blib );
-
-all_pod_files_ok( all_pod_files( @poddirs ) );
diff --git a/t/author-eof.t b/t/author-eof.t new file mode 100644 index 0000000..0ae7431 --- /dev/null +++ b/t/author-eof.t @@ -0,0 +1,19 @@ + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +use strict; +use warnings; +use Test::More; + +# Generated by Dist::Zilla::Plugin::Test::EOF 0.0600 +eval "use Test::EOF"; +plan skip_all => 'Test::EOF required to test for correct end of file flag' if $@; + +all_perl_files_ok({ minimum_newlines => 1, maximum_newlines => 4 }); + +done_testing(); diff --git a/t/author-eol.t b/t/author-eol.t new file mode 100644 index 0000000..de8ed4a --- /dev/null +++ b/t/author-eol.t @@ -0,0 +1,45 @@ + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 + +use Test::More 0.88; +use Test::EOL; + +my @files = ( + 'lib/Graphics/ColorNames.pm', + 'lib/Graphics/ColorNames/X.pm', + 't/00-report-prereqs.dd', + 't/00-report-prereqs.t', + 't/01-exports.t', + 't/02-X.t', + 't/03-oo.t', + 't/04-precedence.t', + 't/05-tied.t', + 't/07-file.t', + 't/08-filehandle.t', + 't/09-colorlibrary.t', + 't/10-sub.t', + 't/author-eof.t', + 't/author-eol.t', + 't/author-minimum-version.t', + 't/author-no-tabs.t', + 't/author-pod-linkcheck.t', + 't/author-pod-syntax.t', + 't/author-portability.t', + 't/lib/Graphics/ColorNames/Test.pm', + 't/release-check-manifest.t', + 't/release-fixme.t', + 't/release-trailing-space.t' +); + +eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; +done_testing; diff --git a/t/author-minimum-version.t b/t/author-minimum-version.t new file mode 100644 index 0000000..db391de --- /dev/null +++ b/t/author-minimum-version.t @@ -0,0 +1,14 @@ + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +use strict; +use warnings; + +use Test::More; +use Test::MinimumVersion; +all_minimum_version_from_metayml_ok(); diff --git a/t/author-no-tabs.t b/t/author-no-tabs.t new file mode 100644 index 0000000..e6f3aa0 --- /dev/null +++ b/t/author-no-tabs.t @@ -0,0 +1,45 @@ + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 + +use Test::More 0.88; +use Test::NoTabs; + +my @files = ( + 'lib/Graphics/ColorNames.pm', + 'lib/Graphics/ColorNames/X.pm', + 't/00-report-prereqs.dd', + 't/00-report-prereqs.t', + 't/01-exports.t', + 't/02-X.t', + 't/03-oo.t', + 't/04-precedence.t', + 't/05-tied.t', + 't/07-file.t', + 't/08-filehandle.t', + 't/09-colorlibrary.t', + 't/10-sub.t', + 't/author-eof.t', + 't/author-eol.t', + 't/author-minimum-version.t', + 't/author-no-tabs.t', + 't/author-pod-linkcheck.t', + 't/author-pod-syntax.t', + 't/author-portability.t', + 't/lib/Graphics/ColorNames/Test.pm', + 't/release-check-manifest.t', + 't/release-fixme.t', + 't/release-trailing-space.t' +); + +notabs_ok($_) foreach @files; +done_testing; diff --git a/t/author-pod-linkcheck.t b/t/author-pod-linkcheck.t new file mode 100644 index 0000000..9de0718 --- /dev/null +++ b/t/author-pod-linkcheck.t @@ -0,0 +1,28 @@ +#!perl + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + + +use strict; +use warnings; +use Test::More; + +foreach my $env_skip ( qw( + SKIP_POD_LINKCHECK +) ){ + plan skip_all => "\$ENV{$env_skip} is set, skipping" + if $ENV{$env_skip}; +} + +eval "use Test::Pod::LinkCheck"; +if ( $@ ) { + plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; +} +else { + Test::Pod::LinkCheck->new->all_pod_ok; +} diff --git a/t/author-pod-syntax.t b/t/author-pod-syntax.t new file mode 100644 index 0000000..2233af0 --- /dev/null +++ b/t/author-pod-syntax.t @@ -0,0 +1,15 @@ +#!perl + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use strict; use warnings; +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff --git a/t/author-portability.t b/t/author-portability.t new file mode 100644 index 0000000..b6c3147 --- /dev/null +++ b/t/author-portability.t @@ -0,0 +1,18 @@ + +BEGIN { + unless ($ENV{AUTHOR_TESTING}) { + print qq{1..0 # SKIP these tests are for testing by the author\n}; + exit + } +} + +use strict; +use warnings; + +use Test::More; + +eval 'use Test::Portability::Files'; +plan skip_all => 'Test::Portability::Files required for testing portability' + if $@; + +run_tests(); diff --git a/t/lib/Graphics/ColorNames/Test.pm b/t/lib/Graphics/ColorNames/Test.pm new file mode 100755 index 0000000..71f5bb5 --- /dev/null +++ b/t/lib/Graphics/ColorNames/Test.pm @@ -0,0 +1,32 @@ +package Graphics::ColorNames::Test; + +use v5.6; + +use strict; +use warnings; + +sub NamesRgbTable() { + use integer; + return { + 'black' => 0x000000, + 'blue' => 0x0000ff, + 'cyan' => 0x00ffff, + 'green' => 0x00ff00, + 'magenta' => 0xff00ff, + 'red' => 0xff0000, + 'yellow' => 0xffff00, + 'white' => 0xffffff, + 'darkblue' => 0x000080, + 'darkcyan' => 0x008080, + 'darkgreen' => 0x008000, + 'darkmagenta' => 0x800080, + 'darkred' => 0x800000, + 'darkyellow' => 0x808000, + 'darkgray' => 0x808080, + 'lightgray' => 0xc0c0c0, + }; +} + +1; + +__END__ diff --git a/t/release-check-manifest.t b/t/release-check-manifest.t new file mode 100644 index 0000000..f0c12c7 --- /dev/null +++ b/t/release-check-manifest.t @@ -0,0 +1,24 @@ +#!perl -T + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + print qq{1..0 # SKIP these tests are for release candidate testing\n}; + exit + } +} + + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + require Test::More; + Test::More::plan(skip_all => 'these tests are for release candidate testing'); + } +} + +use Test::More; + +eval "use Test::CheckManifest 1.24"; +plan skip_all => "Test::CheckManifest 1.24 required for testing MANIFEST" + if $@; + +ok_manifest(); diff --git a/t/release-fixme.t b/t/release-fixme.t new file mode 100644 index 0000000..a80ed7e --- /dev/null +++ b/t/release-fixme.t @@ -0,0 +1,16 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + print qq{1..0 # SKIP these tests are for release candidate testing\n}; + exit + } +} + + +# This test is generated by Dist::Zilla::Plugin::Test::Fixme +use strict; +use warnings; + +use Test::Fixme; +run_tests(); diff --git a/t/release-trailing-space.t b/t/release-trailing-space.t new file mode 100644 index 0000000..28367cd --- /dev/null +++ b/t/release-trailing-space.t @@ -0,0 +1,38 @@ +#!perl + +BEGIN { + unless ($ENV{RELEASE_TESTING}) { + print qq{1..0 # SKIP these tests are for release candidate testing\n}; + exit + } +} + + +use strict; +use warnings; + +use Test::More; + +eval "use Test::TrailingSpace"; +if ($@) +{ + plan skip_all => "Test::TrailingSpace required for trailing space test."; +} +else +{ + plan tests => 1; +} + +# TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly +# some other stuff. +my $finder = Test::TrailingSpace->new( + { + root => '.', + filename_regex => qr#\.(?:p[lm]|pod)\z#, + }, +); + +# TEST +$finder->no_trailing_space( + "No trailing space was found." +); diff --git a/weaver.ini b/weaver.ini new file mode 100644 index 0000000..1f70d4b --- /dev/null +++ b/weaver.ini @@ -0,0 +1,35 @@ +[@CorePrep] + +[-SingleEncoding] + +;; [-Transformer] +;; transformer = List + +[Name] +[Version] + +[Region / prelude] + +[Generic / SYNOPSIS] +[Generic / DESCRIPTION] + +[Collect / METHODS] +command = method + +[Collect / EXPORTS] +command = export + +[Leftovers] + +[Region / postlude] + +[SourceGitHub] +[Bugs] + +[Authors] + +[Contributors] + +[Legal] + +[-AppendPrepend] |