summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamyan Ivanov <dmn@debian.org>2015-07-24 04:59:11 -0700
committerDamyan Ivanov <dmn@debian.org>2015-07-24 04:59:11 -0700
commit54f5e952958474e8a788c161d0700dba8017a5ea (patch)
tree8e9969fa196d3cfeb03b316501d07f988ec0c869
libgraphics-colornames-perl (2.11-6.1) unstable; urgency=medium
* Non-maintainer upload. * Add build dependency on libmodule-build-perl and replace perl-modules build dependency with perl Closes: #789334 -- FTBFS with perl 5.22 # imported from the archive
-rwxr-xr-xBuild.PL41
-rwxr-xr-xChanges208
-rw-r--r--MANIFEST26
-rw-r--r--META.yml50
-rw-r--r--Makefile.PL24
-rw-r--r--README135
-rw-r--r--debian/changelog174
-rw-r--r--debian/compat1
-rw-r--r--debian/control23
-rw-r--r--debian/copyright22
-rw-r--r--debian/docs1
-rwxr-xr-xdebian/rules13
-rw-r--r--debian/source/format1
-rw-r--r--debian/source/lintian-overrides1
-rw-r--r--debian/watch4
-rwxr-xr-xlib/Graphics/ColorNames.pm785
-rwxr-xr-xlib/Graphics/ColorNames/HTML.pm76
-rwxr-xr-xlib/Graphics/ColorNames/Netscape.pm175
-rwxr-xr-xlib/Graphics/ColorNames/Windows.pm66
-rwxr-xr-xlib/Graphics/ColorNames/X.pm727
-rw-r--r--t/01-ColorNames.t105
-rw-r--r--t/01-version.t13
-rw-r--r--t/02-X.t28
-rw-r--r--t/03-HTML.t23
-rw-r--r--t/04-Windows.t20
-rw-r--r--t/05-Netscape.t32
-rw-r--r--t/06-obj.t72
-rw-r--r--t/07-file.t24
-rw-r--r--t/08-filehandle.t81
-rw-r--r--t/09-colorlibrary.t37
-rw-r--r--t/10-sub.t32
-rw-r--r--t/90-file-port.t13
-rw-r--r--t/90-pod-coverage.t17
-rw-r--r--t/90-pod.t15
-rwxr-xr-xt/rgb.txt10
35 files changed, 3075 insertions, 0 deletions
diff --git a/Build.PL b/Build.PL
new file mode 100755
index 0000000..3b1169f
--- /dev/null
+++ b/Build.PL
@@ -0,0 +1,41 @@
+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;
diff --git a/Changes b/Changes
new file mode 100755
index 0000000..2e38a81
--- /dev/null
+++ b/Changes
@@ -0,0 +1,208 @@
+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
+
+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
+
+1.05 Fri Sep 3 2004
+ - correction to Graphics::ColourNames
+ - correction to README
+
+1.04 Fri Sep 3 2004
+ - updates to POD
+ - a filehandle for a rgb.txt file can be specified
+
+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
+
+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
+
+0.31 23 Oct 2002
+ - fixed mispelling of "fuchsia" in HTML.pm
+
+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
+
+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
+
+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
+
+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
+
+0.21 12 Mar 2001
+ - fixed an issue with Test::Harness expecting t/*.t tests
+
+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
+
+0.10 19 Feb 2001
+ - original (experimental) version released
+
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..d051d77
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,26 @@
+Build.PL
+Changes
+Makefile.PL
+MANIFEST
+META.yml
+README
+t/01-ColorNames.t
+t/01-version.t
+t/02-X.t
+t/03-HTML.t
+t/04-Windows.t
+t/05-Netscape.t
+t/06-obj.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
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..98ccc80
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,50 @@
+---
+name: Graphics-ColorNames
+version: 2.11
+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
+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
+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
+ 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
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..aa7951c
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,24 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+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
+ }
+ )
+;
diff --git a/README b/README
new file mode 100644
index 0000000..93f5c5e
--- /dev/null
+++ b/README
@@ -0,0 +1,135 @@
+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/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..dc5c829
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,174 @@
+libgraphics-colornames-perl (2.11-6.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Add build dependency on libmodule-build-perl and replace perl-modules
+ build dependency with perl
+ Closes: #789334 -- FTBFS with perl 5.22
+
+ -- Damyan Ivanov <dmn@debian.org> Fri, 24 Jul 2015 11:59:11 +0000
+
+libgraphics-colornames-perl (2.11-6) unstable; urgency=low
+
+ * Moving to unstable.
+
+ -- Manoj Srivastava <srivasta@debian.org> Fri, 11 Apr 2014 22:51:58 -0700
+
+libgraphics-colornames-perl (2.11-5) experimental; urgency=low
+
+ * Moved to a new, dh based build schema
+
+ -- Manoj Srivastava <srivasta@debian.org> Sun, 28 Apr 2013 04:05:12 -0700
+
+libgraphics-colornames-perl (2.11-4) unstable; urgency=low
+
+ *
+ * [fdfdf3a]: [ligraphics-colornames-perl]: PREFIX is no longer
+ mutable, use DESTDIR. Preemptive bug fix.
+
+ -- Manoj Srivastava <srivasta@debian.org> Sun, 13 Sep 2009 18:18:57 -0500
+
+libgraphics-colornames-perl (2.11-3) unstable; urgency=low
+
+ * Updated the location of the repository for the package (moved to git)
+ * Moved to the new, stream lined target mechanism in the build system.
+
+ -- Manoj Srivastava <srivasta@debian.org> Thu, 29 May 2008 22:18:01 -0500
+
+libgraphics-colornames-perl (2.11-2) unstable; urgency=low
+
+ * Bug fix: "libgraphics-colornames-perl: FTBFS with Perl 5.10: the empty
+ /usr/lib/perl5 is gone", thanks to Niko Tyni. Actually, not just
+ /usr/lib/perl5 , all of /usr/lib was gone. closes: #467786
+
+ -- Manoj Srivastava <srivasta@debian.org> Tue, 18 Mar 2008 17:43:12 -0500
+
+libgraphics-colornames-perl (2.11-1) unstable; urgency=low
+
+ * New upstream release
+ - updated version number for release
+ - minor changes of text format
+ - added fix for problems with Graphics::ColorNames::GrayScale
+ * checks if modules already loaded before re-loading them
+ (uses Module::Loaded for this)
+ - requires changed to load for dynamically loaded modules
+ - updated README
+ - reverted back to standard object-oriented style
+ - Tie::Sub is only loaded when a subroutine is used for scheme
+ - 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
+ * 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
+ * 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
+ - fixed inconsistencies in Netscape color scheme
+ - fixed glitch with version test
+ - cleaned up format of text files
+ - removed unneeded dependency
+ - 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
+ - Changed versions of specific color schemes to match main module
+ * Removed Graphics::ColourNames from the distribution
+ - updated documentation for Netscape.pm
+ - 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)
+ - 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
+ - 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
+ - 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
+
+ -- Manoj Srivastava <srivasta@debian.org> Thu, 07 Feb 2008 17:03:26 -0600
+
+libgraphics-colornames-perl (1.06-1) unstable; urgency=low
+
+ * New upstream release
+ - 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
+
+ -- Manoj Srivastava <srivasta@debian.org> Sun, 1 May 2005 11:31:45 -0500
+
+libgraphics-colornames-perl (1.05-1) unstable; urgency=low
+
+ * New upstream release.
+ - updates to POD
+ - correction to Graphics::ColourNames
+ - correction to README
+ - a filehandle for a rgb.txt file can be specified
+ - hooks to support CODE scheme types (as with module
+ Graphics::ColorNames::GrayScale 2.00)
+ - ColourNames.pm has same version of ColorNames.pm
+ - added Graphics::ColourNames alias
+ - minor changes to ColorNames.pm
+ - 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
+ - corrected bad link in POD
+ - rebuilt distribution with proper META.yml
+ - added required rgb.txt for tests to MANIFEST and distro
+ * 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
+ - added Build.PL to distribution
+ - added hex() and rgb() methods
+ - created object-oriented interface
+ - additions and corrections in POD
+
+ -- Manoj Srivastava <srivasta@debian.org> Fri, 1 Oct 2004 12:49:42 -0500
+
+libgraphics-colornames-perl (0.32-1) unstable; urgency=low
+
+ * New package, initial packaging for Debian.
+
+ -- Manoj Srivastava <srivasta@debian.org> Sat, 24 Apr 2004 21:28:07 -0500
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..90b58d6
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,23 @@
+Source: libgraphics-colornames-perl
+VCS-Git: git://anonscm.debian.org/users/srivasta/debian/libgraphics-colornames-perl.git
+VCS-Browser: http://anonscm.debian.org/gitweb/?p=users/srivasta/debian/libgraphics-colornames-perl.git
+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.5
+Build-Depends-Indep: perl, libmodule-build-perl, libmodule-load-perl, libpod-coverage-perl,
+ libtest-pod-perl, libtest-exception-perl, debhelper (>= 9.0.0)
+
+Package: libgraphics-colornames-perl
+Architecture: all
+Depends: ${misc:Depends}, perl, libmodule-load-perl
+Recommends: libpod-coverage-perl, libtest-pod-perl
+Description: defines RGB values for common color names
+ This package defines RGB values for common color names. The intention
+ is to:
+ 1. provide a common module that authors can use with other modules
+ to specify colors; 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.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..2d905d3
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,22 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: libgraphics-colornames-perl
+Source: <url:http://search.cpan.org/~rrwo/>
+
+Files: *
+Copyright: 2001-2008 Robert Rothenberg
+License: Artistic-1.0
+
+Files: debian/*
+Copyright: 2013 Manoj Srivastava <srivasta@debian.org>
+License: Artistic-1.0
+
+License: Artistic-1.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.
+ .
+ THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
+ OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ .
+ On Debian systems, the complete text of the Artistic License
+ can be found in "/usr/share/common-licenses/Artistic".
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..b760bee
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+ dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..95b32fc
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1 @@
+libgraphics-colornames-perl source: debian-watch-may-check-gpg-signature
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..16558e6
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+# format version number, currently 2; this line is compulsory!
+version=2
+
+http://www.cpan.org/modules/by-module/Graphics/Graphics-ColorNames-([0-9].*)\.tar\.gz debian
diff --git a/lib/Graphics/ColorNames.pm b/lib/Graphics/ColorNames.pm
new file mode 100755
index 0000000..f50b93b
--- /dev/null
+++ b/lib/Graphics/ColorNames.pm
@@ -0,0 +1,785 @@
+package Graphics::ColorNames;
+use 5.006;
+
+use base "Exporter";
+
+use strict;
+use warnings;
+
+# use AutoLoader;
+use Carp;
+use Module::Load 0.10;
+use Module::Loaded;
+
+our $VERSION = '2.11';
+# $VERSION = eval $VERSION;
+
+our %EXPORT_TAGS = (
+ 'all' => [ qw( hex2tuple tuple2hex all_schemes ) ],
+ 'utility' => [ qw( hex2tuple tuple2hex ) ],
+);
+our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+our @EXPORT = ( );
+
+# 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;
+ }
+}
+
+
+sub _load {
+ 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 $module = join('::', $base, (my $scheme = shift));
+ eval { _load($module); };
+ if ($@) {
+ eval { _load($module = $scheme); };
+ if ($@) {
+ croak "Cannot load color naming scheme \`$module\'";
+ }
+ }
+
+ {
+ no strict 'refs';
+ if ($module =~ $base) {
+ $self->load_scheme($module->NamesRgbTable);
+ }
+ elsif ($module =~ /Color::Library::Dictionary/) {
+ $self->load_scheme($module->_load_color_list);
+ }
+ else {
+ 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 );
+ }
+ }
+ } else {
+ $self->_load_scheme_from_module('X');
+ }
+
+ 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;
+ }
+ }
+}
+
+sub EXISTS {
+ my ($self, $key) = @_;
+ defined ($self->FETCH($key));
+}
+
+sub FIRSTKEY {
+ (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;
+}
+
+sub load_scheme {
+ 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);
+ }
+ elsif ($!) {
+ croak "$!";
+ }
+ else {
+ # everything is ok?
+ }
+ }
+}
+
+sub _find_schemes {
+
+ my $path = shift;
+
+ # 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}++;
+ }
+ }
+ }
+ }
+
+sub _readonly_error {
+ croak "Cannot modify a read-only value";
+}
+
+sub DESTROY {
+ my $self = shift;
+ delete $self->{_schemes};
+ delete $self->{_iterator};
+}
+
+sub UNTIE { # stub to avoid AUTOLOAD
+}
+
+BEGIN {
+ no strict 'refs';
+ *STORE = \ &_readonly_error;
+ *DELETE = \ &_readonly_error;
+ *CLEAR = \ &_readonly_error; # causes problems with 'undef'
+
+ *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);
+}
+
+
+# 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;
+}
+
+sub all_schemes {
+ unless (%FoundSchemes) {
+
+ _load("DirHandle", "File::Spec");
+
+ foreach my $dir (@INC) {
+ _find_schemes(
+ File::Spec->catdir($dir, split(/::/, __PACKAGE__)));
+ }
+ }
+ return (keys %FoundSchemes);
+ }
+
+sub _load_scheme_from_file {
+ my $self = shift;
+ my $file = shift;
+
+ unless (ref $file) {
+ unless (-r $file) {
+ croak "Cannot load scheme from file: \'$file\'";
+ }
+ _load("IO::File");
+ }
+
+ my $fh = ref($file) ? $file : (IO::File->new);
+ unless (ref $file) {
+ open($fh, $file)
+ || croak "Cannot open file: \'$file\'";
+ }
+
+ 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
+
+ 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.
+
+ # unless (exists $scheme->{$name}) {
+
+ $scheme->{$name} = 0;
+ foreach (0, 4, 8) {
+ $scheme->{$name} <<= 8;
+ $scheme->{$name} |= (eval substr($line, $_, 3));
+ }
+
+ # }
+ }
+ }
+ $self->load_scheme( $scheme );
+
+ 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
+
+=begin readme
+
+=head1 REQUIREMENTS
+
+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
+
+The developer tests are for quality-control purposes.
+
+=head1 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 C<nmake> instead.)
+
+Using Build.PL (if you have L<Module::Build> installed):
+
+ perl Build.PL
+ perl Build test
+ perl Build install
+
+=end readme
+
+=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)
+
+ $rgb = $po->green; # same as $po->hex('green');
+
+ tie %ph, 'Graphics::ColorNames', (qw( X ));
+
+ $rgb = $ph{green}; # same as $po->hex('green');
+
+=head1 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.
+
+=begin readme
+
+See the module POD for complete documentation.
+
+=end readme
+
+=for readme stop
+
+For example,
+
+ use Graphics::ColorNames 2.10;
+
+ use GD;
+
+ $pal = new Graphics::ColorNames;
+
+ $img = new GD::Image(100, 100);
+
+ $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>.
+
+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:
+
+ tie %pal, 'Graphics::ColorNames', qw(Color::Library::Dictionary::HTML);
+
+This is an experimental feature which may change in later versions (see
+L</SEE ALSO> for a discussion of the differences between modules).
+
+Multiple schemes can be used:
+
+ tie %pal, 'Graphics::ColorNames', qw(HTML Netscape);
+
+In this case, if the name is not a valid HTML color, the Netscape name
+will be used.
+
+One can load all available schemes in the Graphics::ColorNames namespace
+(as of version 2.0):
+
+ use Graphics::ColorNames 2.0, 'all_schemes';
+ tie %NameTable, 'Graphics::ColorNames', all_schemes();
+
+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).
+
+When no color scheme is specified, the X-Windows scheme is assumed.
+
+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.)
+
+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
+
+ $obj = Graphics::ColorNames->new( @SCHEMES );
+
+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);
+
+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)
+
+ $rgb = $obj->rgb('blue', ','); # returns "0,0,255"
+
+=back
+
+Since version 2.10_02, the interface will assume method names
+are color names and return the hex value,
+
+ $obj->black eq $obj->hex("black")
+
+Method names are case-insensitive, and underscores are ignored.
+
+=head2 Utility Functions
+
+These functions are not exported by default, so much be specified to
+be used:
+
+ use Graphics::ColorNames qw( all_schemes hex2tuple tuple2hex );
+
+=over
+
+=item all_schemes
+
+ @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
+
+The following schemes are available by default:
+
+=over
+
+=item X
+
+About 750 color names used in X-Windows (although about 90+ of them are
+duplicate names with spaces).
+
+=item HTML
+
+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.)
+
+=item Netscape
+
+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
+
+You can add naming scheme files by creating a Perl module is the name
+C<Graphics::ColorNames::SCHEMENAME> which has a subroutine named
+C<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:
+
+ 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 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.
+
+Since version 1.03, C<NamesRgbTable> may also return a code reference:
+
+ package Graphics::ColorNames::Orange;
+
+ sub NamesRgbTable() {
+ return sub {
+ my $name = shift;
+ return 0xffa500;
+ };
+ }
+
+See L<Graphics::ColorNames::GrayScale> for an example.
+
+=head2 Graphics::ColourNames
+
+The alias "Graphics::ColourNames" (British spelling) is no longer available
+as of version 2.01.
+
+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.
+
+=head1 SEE ALSO
+
+L<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.
+
+L<Color::Rgb> has a similar function to this module, but parses an
+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.
+
+=begin readme
+
+=head1 REVISION HISTORY
+
+Changes since the last release:
+
+=for readme include file=Changes start=^2.11 stop=^2.04 type=text
+
+More details can be found in the F<Changes> file.
+
+=end readme
+
+=for readme continue
+
+=head1 AUTHOR
+
+Robert Rothenberg <rrwo at cpan.org>
+
+=for readme stop
+
+=head2 Acknowledgements
+
+Alan D. Salewski <alans at cji.com> for feedback and the addition of
+C<tuple2hex>.
+
+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.
+
+=head2 Suggestions and Bug Reporting
+
+Feedback is always welcome. Please use the CPAN Request Tracker at
+L<http://rt.cpan.org> to submit bug reports.
+
+There is a Sourceforge project for this package at
+L<http://sourceforge.net/projects/colornames/>.
+
+If you create additional color schemes, please make them available
+separately in CPAN rather than submit them to me for inclusion into
+this module.
+
+=for readme continue
+
+=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
diff --git a/lib/Graphics/ColorNames/HTML.pm b/lib/Graphics/ColorNames/HTML.pm
new file mode 100755
index 0000000..05036ab
--- /dev/null
+++ b/lib/Graphics/ColorNames/HTML.pm
@@ -0,0 +1,76 @@
+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
new file mode 100755
index 0000000..a694a83
--- /dev/null
+++ b/lib/Graphics/ColorNames/Netscape.pm
@@ -0,0 +1,175 @@
+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
new file mode 100755
index 0000000..ef39abc
--- /dev/null
+++ b/lib/Graphics/ColorNames/Windows.pm
@@ -0,0 +1,66 @@
+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
new file mode 100755
index 0000000..481f329
--- /dev/null
+++ b/lib/Graphics/ColorNames/X.pm
@@ -0,0 +1,727 @@
+package Graphics::ColorNames::X;
+
+=head1 NAME
+
+Graphics::ColorNames::X - X-Windows color names and equivalent RGB values
+
+=head1 SYNOPSIS
+
+ require Graphics::ColorNames::X;
+
+ $NameTable = Graphics::ColorNames::X->NamesRgbTable();
+ $RgbBlack = $NameTable->{black};
+
+=head1 DESCRIPTION
+
+This module defines color names and their associated RGB values used in
+X-Windows (from the X-Windows C<rgb.txt> file).
+
+=head1 SEE ALSO
+
+L<Graphics::ColorNames>, rgb.txt
+
+=head1 AUTHOR
+
+Robert Rothenberg <rrwo at cpan.org>
+
+=head2 Acknowledgements
+
+Steve Pomeroy <steve_x at earthling.net> -- fixed the broken color definitions
+
+=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;
+
+# Original name and colors (v1.01 and earlier) from Kevin J. Walsh,
+# http://eies.njit.edu/~walsh/rgb.html
+
+# 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
+
+# Duplicate namesiwth spaces were removed in v2.10.
+
+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,
+ };
+}
+
+1;
+
+__END__
+
diff --git a/t/01-ColorNames.t b/t/01-ColorNames.t
new file mode 100644
index 0000000..5d5bad5
--- /dev/null
+++ b/t/01-ColorNames.t
@@ -0,0 +1,105 @@
+#!/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-version.t b/t/01-version.t
new file mode 100644
index 0000000..ac2a11c
--- /dev/null
+++ b/t/01-version.t
@@ -0,0 +1,13 @@
+#!/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);
+}
+
diff --git a/t/02-X.t b/t/02-X.t
new file mode 100644
index 0000000..0923507
--- /dev/null
+++ b/t/02-X.t
@@ -0,0 +1,28 @@
+#!/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");
+ }
+}
diff --git a/t/03-HTML.t b/t/03-HTML.t
new file mode 100644
index 0000000..f59d6dd
--- /dev/null
+++ b/t/03-HTML.t
@@ -0,0 +1,23 @@
+#!/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/04-Windows.t b/t/04-Windows.t
new file mode 100644
index 0000000..870c19c
--- /dev/null
+++ b/t/04-Windows.t
@@ -0,0 +1,20 @@
+#!/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/05-Netscape.t b/t/05-Netscape.t
new file mode 100644
index 0000000..b08ebd9
--- /dev/null
+++ b/t/05-Netscape.t
@@ -0,0 +1,32 @@
+#!/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/06-obj.t b/t/06-obj.t
new file mode 100644
index 0000000..a0a8808
--- /dev/null
+++ b/t/06-obj.t
@@ -0,0 +1,72 @@
+#!/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
new file mode 100644
index 0000000..1bd448c
--- /dev/null
+++ b/t/07-file.t
@@ -0,0 +1,24 @@
+#!/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});
+}
diff --git a/t/08-filehandle.t b/t/08-filehandle.t
new file mode 100644
index 0000000..fae6f9e
--- /dev/null
+++ b/t/08-filehandle.t
@@ -0,0 +1,81 @@
+#!/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;
+}
diff --git a/t/09-colorlibrary.t b/t/09-colorlibrary.t
new file mode 100644
index 0000000..5370c1a
--- /dev/null
+++ b/t/09-colorlibrary.t
@@ -0,0 +1,37 @@
+#!/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");
+ }
+
+}
diff --git a/t/10-sub.t b/t/10-sub.t
new file mode 100644
index 0000000..97714b0
--- /dev/null
+++ b/t/10-sub.t
@@ -0,0 +1,32 @@
+#!/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
new file mode 100644
index 0000000..36a8fe4
--- /dev/null
+++ b/t/90-file-port.t
@@ -0,0 +1,13 @@
+#!/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
new file mode 100644
index 0000000..f533eea
--- /dev/null
+++ b/t/90-pod-coverage.t
@@ -0,0 +1,17 @@
+#!/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
new file mode 100644
index 0000000..cace2ad
--- /dev/null
+++ b/t/90-pod.t
@@ -0,0 +1,15 @@
+#!/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/rgb.txt b/t/rgb.txt
new file mode 100755
index 0000000..72fb6f2
--- /dev/null
+++ b/t/rgb.txt
@@ -0,0 +1,10 @@
+# based on $Xorg: rgb.txt,v 1.3 2000/08/17
+! another comment
+255 250 250 one
+248 248 255 two
+248 248 255 three
+245 245 245 four
+! trailing spaces
+245 245 245 five
+! spaces instead of tabs:
+220 220 220 six