Color-Calc-1.074000755000765000024 012411507276 13505 5ustar00cfaerberstaff000000000000Color-Calc-1.074/Build.PL000444000765000024 206512411507274 15137 0ustar00cfaerberstaff000000000000#!/usr/bin/perl use 5.006; use strict; use utf8; use Module::Build; my $b = Module::Build->new( 'module_name' => 'Color::Calc', 'license' => 'perl', 'dist_author' => 'Claus Faerber ', 'sign' => 1, 'create_license' => 1, 'create_makefile_pl' => 'traditional', 'requires' => { 'Graphics::ColorNames' => 2.10, 'Graphics::ColorNames::WWW' => 0.01, 'Graphics::ColorNames::HTML'=> 0, 'Params::Validate' => 0.75, }, 'build_requires' => { 'Test::More' => 0, 'Test::NoWarnings' => 0, }, auto_features => { 'color_object_support' => { 'description' => 'support for Color::Object (obsolete)', 'requires' => { 'Color::Object' => 1, } }, 'graphics_colorobject_support' => { 'description' => 'support for Graphics::ColorObject', 'requires' => { 'Graphics::ColorObject' => 0.005, } }, }, 'no_index' => { 'directory' => ['eg'] }, 'resources' => { 'homepage' => 'http://search.cpan.org/dist/Color-Calc', 'repository' => 'http://github.com/cfaerber/Color-Calc', }, ); $b->create_build_script; Color-Calc-1.074/Changes000444000765000024 656012411507274 15142 0ustar00cfaerberstaff000000000000Revision history for Perl extension Color::Calc. 1.074 (2014-09-27): - FIXES: #99150: not everything from POSIX (reported by JHI) 1.073 (2012-06-29) - FIXES: compile error due to warning "Non-ASCII character seen before =encoding in '...'. Assuming UTF-8" 1.072 (2011-12-08) - FIXES: #72615 faulty data in Build.PL causes a lack of meta files, which breaks carton. 1.071 (2011-03-07) - FIXES: #66357: Cannot Build the library on Debian (reported by SILASMONK) 1.070 (2010-10-20) - better workaround for #54500, now also works with explicit scheme specifications (e.g. 'HTML'), not just the default value - unsupported output formats (due to uninstalled modules) now croak at import - allow all types of colour schemes acceptet by Graphics::ColorNames - add missing tests for Color::Calc::color_* calls 1.061 (2010-02-11) - workaround for #54500: ambiguity between module and file names in TIEHASH in Color::GraphicsName (reported here by sunnavy) 1.060 (2010-01-01) - release 1.059_20091227 1.059_20091227 - new calc functions: opposite, round, safe 1.059_20091226 - use Scalar::Util, List::Util - some clean-ups and refactorisations - remove obsolete modules 1.052 Mon Dec 14 00:00:00 2009 - switch to Module::Build - FIXES: #52744: Undeclared dependency on Test::NoWarnings (reported by ANDK) - better documentation 1.051 Fri Dec 11 00:00:00 2009 - documentation and meta information fixes, switch to Github - no API/functionality changes 1.05 Sun Sep 14 22:00:00 2008 - use warnings everywhere - use strict everywhere - Test::Pod & Test::Pod::Coverage - cleanup 1.04 Sun Dec 10 22:00:00 2006 - fixed last test w/ Graphics::ColorObject (reported by Nelson Elhage) 1.03 Thu Nov 16 16:45:00 2006 - documentation update - fixes and tests for 'pdf' format 1.02 Mon Nov 13 00:00:00 2006 - fixed tests without Graphics::ColorObject 1.01 Sat Nov 11 11:11:11 2006 - fixed tests w/ Graphics::ColorObject (reported by Ernesto Hernández-Novich) - fixed dependencies (reported by Ernesto Hernández-Novich) 1.00 Sat Sep 24 20:00:00 2005 - new 'pdf' output format, which is accepted by PDF::API2 v.40 - allow any number of hex digits per color in #RGB/#RRGGBB/ #RRRGGGBBB/... - better tests - FIX: #13731 import w/ use does not work under mod_perl 0.29_0003 Sat Apr 09 20:00:00 2005 - fixed MANIFEST (broken distribution) 0.29_0002 Sat Mar 26 16:20:00 2005 - Color::Calc::WWW now uses Graphics::ColorNames::WWW - Color::Calc::WWW was missing from distribution - removed 'pdf' output format as PDF::API2::Color is no longer - complete test suite 0.29_0001 Fri Mar 25 12:00:00 2005 - added object-orientated interface - added procedural interface with customisation on import - added Color::Calc::WWW - color scheme is now selectable 0.20 Mon Mar 28 00:00:00 2004 - added Color::Calc:: modules to select return type - added $Color::Calc::MODE to select return type - return value of xxx_tuple can be used as parameter - _html returns color names instead of #RRGGBB if possible - support for Graphics::ColorObject (input/output) - support for PDF::API2::Color (input/output) - fixed import list 0.12 Thu Mar 18 00:00:00 2004 - added xxx_html - should work with perl 5.005 now 0.10 Sun May 04 00:00:00 2003 - added tests - added more functions - some documentation corrections 0.02 Sat Apr 26 00:00:00 2003 - first public release Color-Calc-1.074/LICENSE000444000765000024 4375412411507274 14702 0ustar00cfaerberstaff000000000000This software is copyright (c) 2014 by Claus Faerber . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Claus Faerber . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Claus Faerber . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. 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. The End Color-Calc-1.074/Makefile.PL000444000765000024 111612411507274 15611 0ustar00cfaerberstaff000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.4208 use ExtUtils::MakeMaker; WriteMakefile ( 'PL_FILES' => {}, 'INSTALLDIRS' => 'site', 'NAME' => 'Color::Calc', 'EXE_FILES' => [], 'VERSION_FROM' => 'lib/Color/Calc.pm', 'PREREQ_PM' => { 'Test::More' => 0, 'Params::Validate' => '0.75', 'Graphics::ColorNames::HTML' => 0, 'Graphics::ColorNames::WWW' => '0.01', 'Test::NoWarnings' => 0, 'Graphics::ColorNames' => '2.1' } ) ; Color-Calc-1.074/MANIFEST000444000765000024 116612411507274 14775 0ustar00cfaerberstaff000000000000Build.PL Changes eg/style-sheet.asp eg/style-sheet.pl lib/Color/Calc.pm lib/Color/Calc/WWW.pm LICENSE Makefile.PL MANIFEST MANIFEST.SKIP META.yml README t/00basic.t t/10pod.t t/11pod_cover.t t/color_opposite.t t/color_round.t t/color_safe.t t/DEPRECATED_import_MODEval.t t/DEPRECATED_import_suffix.t t/DEPRECATED_non-import_MODEval.t t/DEPRECATED_non-import_suffix.t t/import_hex.t t/import_html.t t/import_MODEval.t t/import_object.t t/import_tuple.t t/import_WWW.t t/input_import.t t/input_oo.t t/object-orientated.t t/schemes_import_HTML.t t/schemes_import_X.t t/schemes_oo.t META.json SIGNATURE Added here by Module::Build Color-Calc-1.074/MANIFEST.SKIP000444000765000024 13712411507274 15517 0ustar00cfaerberstaff000000000000^MYMETA.yml$ ^\.git ^blib/ ^_build/ ^Build$ .*-.*\.tar\.gz$ ^Color-Calc-.* .*\.bak$ ^HTML$ ^X$ Color-Calc-1.074/META.json000444000765000024 211012411507274 15253 0ustar00cfaerberstaff000000000000{ "abstract" : "Simple calculations with RGB colors.", "author" : [ "Claus Faerber " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4208", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Color-Calc", "no_index" : { "directory" : [ "eg" ] }, "prereqs" : { "build" : { "requires" : { "Test::More" : "0", "Test::NoWarnings" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.42" } }, "runtime" : { "requires" : { "Graphics::ColorNames" : "2.1", "Graphics::ColorNames::HTML" : "0", "Graphics::ColorNames::WWW" : "0.01", "Params::Validate" : "0.75" } } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "1.074" } Color-Calc-1.074/META.yml000444000765000024 123212411507274 15107 0ustar00cfaerberstaff000000000000--- abstract: 'Simple calculations with RGB colors.' author: - 'Claus Faerber ' build_requires: Test::More: '0' Test::NoWarnings: '0' configure_requires: Module::Build: '0.42' dynamic_config: 1 generated_by: 'Module::Build version 0.4208, CPAN::Meta::Converter version 2.142060' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Color-Calc no_index: directory: - eg requires: Graphics::ColorNames: '2.1' Graphics::ColorNames::HTML: '0' Graphics::ColorNames::WWW: '0.01' Params::Validate: '0.75' resources: license: http://dev.perl.org/licenses/ version: '1.074' Color-Calc-1.074/README000444000765000024 130212411507274 14514 0ustar00cfaerberstaff000000000000Color::Calc =========== The "Color::Calc" module implements simple calculations with RGB colors. This can be used to create a full color scheme from a few colors. The module is useful for CGI (or embedded perl) programmes that create HTML or CSS output. INSTALLATION To install this module type the following: perl Build.PL ./Build ./Build test ./Build install DEPENDENCIES This module requires these other modules and libraries: Graphics::ColorNames The following modules are optional: Graphics::ColorObject COPYRIGHT AND LICENCE Copyright © 2004-2010 Claus Färber This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Color-Calc-1.074/SIGNATURE000644000765000024 616612411507276 15141 0ustar00cfaerberstaff000000000000This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 SHA1 01ee761cd1d9e4b60c226a5e7a311da95149994a Build.PL SHA1 39c9544e35b2e1f67715c271c9653edf1fa6b4a4 Changes SHA1 827ef1f8307d42d70d9407be2670e80ade7f007f LICENSE SHA1 723a226a473c615c649838fbf2c01f50856a96f5 MANIFEST SHA1 3d70456e64d970a5fe3acc6ac2033133de70d342 MANIFEST.SKIP SHA1 c5ed06f60901cdf7d7c0d3872beccdfc2ba00fa6 META.json SHA1 9f6be8c1012f81a665eb87e5f6807160df2ab0ca META.yml SHA1 817ddad4e4feaf47df1da3523373d57dca44e0d8 Makefile.PL SHA1 5ed9e2aadb613986d5ac3a78aaad9c75ffbed777 README SHA1 9d1b1a2592814a5faf66fe2b54c7617f11ceb958 eg/style-sheet.asp SHA1 42e5f6066aeb6a6628d09c04159a9bca2af8a15d eg/style-sheet.pl SHA1 82eacfd69463622f9376ee5014808ea843a4ae26 lib/Color/Calc.pm SHA1 401fa9aab05c72704c96513dbf23c6c9a313e5b9 lib/Color/Calc/WWW.pm SHA1 dd5e2852432a4d8a54d31a74f4f003f88b405473 t/00basic.t SHA1 056063d18c3f48338620bbff698f81f91f2ea4d0 t/10pod.t SHA1 e2b1f468d6ea1199f0d68655d25532095435aac8 t/11pod_cover.t SHA1 54e4cc9aa1b95c1207a0b7fe505a7fc3096ef5b4 t/DEPRECATED_import_MODEval.t SHA1 06bf92fe8ca89d99d76b1c19e698ffff50e1a3f9 t/DEPRECATED_import_suffix.t SHA1 35bac9ad47423d312eb8ad4afd549d43af2e0487 t/DEPRECATED_non-import_MODEval.t SHA1 a3986b8e72a3085f8eae6c7c68ff114fa59f0ad5 t/DEPRECATED_non-import_suffix.t SHA1 4e8ff91a5d3a40f4f64a79598dd97fc44c431f33 t/color_opposite.t SHA1 69a713d2b91ce77d3b4114db6e7da74ecc6b4ad8 t/color_round.t SHA1 c0c72124a020a1d3b17ae3877be8e59deef918ca t/color_safe.t SHA1 193eb24082f96dbdf2583e7befd20431d857484d t/import_MODEval.t SHA1 a4882816406cf9f8f7205f8420894651fa13b45c t/import_WWW.t SHA1 a0a5b31e8c3726bc4a111a84dd77869e55413678 t/import_hex.t SHA1 898e52e203b9c19e486cffc59b2494870370b445 t/import_html.t SHA1 e3f8994b5043707a36b84a4ace3f5bf1cd709c44 t/import_object.t SHA1 7f9add37de26d3482f7055a9b7acca1bdfbba085 t/import_tuple.t SHA1 327c1093fd5169461ee4896f3abec3dc03ce27ec t/input_import.t SHA1 c9bc6ff10d2f99e366a1a466561c8765d07d286d t/input_oo.t SHA1 aecc3997d1697c21382f3703bea8605a8fe2aead t/object-orientated.t SHA1 f2f7d33d66bc54c58e7bae2bcaa394186c8ed949 t/schemes_import_HTML.t SHA1 0ab6466fd71de056a14dd8c039816c0bf9d00afc t/schemes_import_X.t SHA1 db1f43e67cd656e7b02a253570e922b3354a4479 t/schemes_oo.t -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJUJo68AAoJEIS+srvgrWBmP9AIAJukRHame9lNxpizhYkj+RyF lRUi0b+SdN2I+f3bjW5ACfJ8+72Z3z1FsUvw1tHXX9UN8/k+v1LnXScpmscekBu4 dgcu+1jWf3B254dXYW/c1u/xfiNPs7Mcd1HR/IDBUoDPCQjWJohP6y2XjUCYuN5c W3hInkoKGMFA4M0kmnOR7XtBgssmVmjc5BfSbrPLZVFGvvosB8FV/F/61d5Gz9Ec kSpCvRVPERqt/xlaf25Is5g3iSkgsoxW2pDqYxuLLN/8iGoHvTvSCrup04vIwk9t Pme3ZA1FeUfBZ8XLj74iUXniL/rbaBRbMk8YkRfRO7KGot2sRxzjyFhJT1U+4wU= =ScEx -----END PGP SIGNATURE----- Color-Calc-1.074/eg000755000765000024 012411507274 14076 5ustar00cfaerberstaff000000000000Color-Calc-1.074/eg/style-sheet.asp000444000765000024 104512411507274 17206 0ustar00cfaerberstaff000000000000<% # This example script uses Apache::ASP, which allows embedding perl in HTML # or other text files, see http://search.cpan.org/perldoc?Apache::ASP use Color::Calc::WWW; $Response->{'ContentType'} = 'text/css; charset=utf-8'; $col1 = '#EEE'; $col2 = '#908'; $bkg = $col1; $fg = color_contrast(color_grey($bkg)); $bk2 = $col2; $fg2 = color_contrast(color_grey($bk2)); %> body { background: <%= $bkg %>; color: <%= $fg %>; } h1 { background: <%= $bk2 %>; color: <%= $fg2 %>; } Color-Calc-1.074/eg/style-sheet.pl000444000765000024 67012411507274 17021 0ustar00cfaerberstaff000000000000#!/usr/bin/perl use utf8; use strict; use Color::Calc::WWW; binmode STDOUT, ':utf8:crlf'; my $col1 = '#EEE'; my $col2 = '#908'; my $bkg = $col1; my $fg = color_contrast(color_grey($bkg)); my $bk2 = $col2; my $fg2 = color_contrast(color_grey($bk2)); print <<__EOF; Content-Type: text/css; charset=utf-8 body { background: $bkg; color: $fg; } h1 { background: $bk2; color: $fg2; } __EOF Color-Calc-1.074/lib000755000765000024 012411507274 14251 5ustar00cfaerberstaff000000000000Color-Calc-1.074/lib/Color000755000765000024 012411507274 15327 5ustar00cfaerberstaff000000000000Color-Calc-1.074/lib/Color/Calc.pm000444000765000024 4736412411507274 16722 0ustar00cfaerberstaff000000000000package Color::Calc; use attributes; use strict; use utf8; use warnings; use Carp; use Exporter; use Params::Validate qw(:all); use POSIX (); use Scalar::Util qw(dualvar); use List::Util qw(min max reduce sum); use Graphics::ColorNames qw( hex2tuple tuple2hex ); use Graphics::ColorNames::HTML qw(); our $VERSION = "1.074"; $VERSION = eval $VERSION; our $MODE = (); my %__HTMLColors = (); our @__subs = qw( blend blend_bw bw contrast contrast_bw dark get gray grey invert light mix opposite round safe ); sub __put_tuple { map { my $a = int($_); length($a) % 3 ? $a : dualvar($a, "0$a") } @_ }; sub __put_hex { dualvar((reduce { ($a << 8) | ($b & 0xFF) } @_), tuple2hex(@_)) }; sub __put_html { my $col = lc(tuple2hex(@_)); $__HTMLColors{$col} || '#'.$col; }; sub __put_object{ return Graphics::ColorObject->new_RGB255( \@_, '', '' ); }; sub __put_obj { return Color::Object->newRGB(map { 255*$_; } @_); }; my %__formats = ( map { m/^__put_(.*)/ ? ( $1 => $Color::Calc::{$_} ) : () } keys %Color::Calc:: ); # use Data::Dumper; # print STDERR Dumper(\%__formats); my %__formats_require = ( 'obj' => 'Color::Object', 'object' => 'Graphics::ColorObject', ); $__formats{'pdf'} = $__formats{'html'}; my @__formats = keys %__formats; my $__formats_re = join('|', @__formats,'__MODEvar'); { my $table = Graphics::ColorNames::HTML::NamesRgbTable(); %__HTMLColors = map { ( sprintf('%06x', $$table{$_}) => $_ ) } grep { $_ ne 'fuscia' } keys %$table; }; our @EXPORT = ('color', map({"color_$_"} @__formats, map({my $s=$_; (map{$s.'_'.$_} @__formats)} @__subs), @__subs)); our @ISA = ('Exporter'); my %new_param = ( 'ColorScheme' => { type => SCALAR | HANDLE | HASHREF | ARRAYREF | CODEREF, optional => 1 }, 'OutputFormat' => { type => SCALAR, untaint => 1, regexp => qr($__formats_re), optional => 1 }, ); sub new { my $pkg = shift; validate(@_, \%new_param); my $self = {@_}; bless($self, $pkg); unless(UNIVERSAL::isa($self->{'ColorScheme'}, 'Graphics::ColorNames')) { my %ColorNames; if(defined $self->{'ColorScheme'}) { if(!ref $self->{'ColorScheme'} && $self->{'ColorScheme'} =~ m/^([[:alnum:]_]+)$/) { my $module = 'Graphics::ColorNames::'.$1; eval "use $module;"; croak $! if $@; my $names = UNIVERSAL::can($module, 'NamesRgbTable'); croak "$module is not compatible with Graphics::ColorNames" if !$names; $self->{'ColorScheme'} = &$names(); } tie %ColorNames, 'Graphics::ColorNames', $self->{'ColorScheme'}; } else { tie %ColorNames, 'Graphics::ColorNames'; } $self->{'ColorScheme'} = \%ColorNames; } $self->set_output_format($self->{'OutputFormat'} || 'tuple'); return $self; } my $__default_object = undef; sub __get_default { $__default_object = __PACKAGE__->new('OutputFormat' => '__MODEvar') unless $__default_object; return $__default_object; } my $__raw_object = undef; sub __get_raw { $__raw_object = __PACKAGE__->new('OutputFormat' => 'tuple') unless $__raw_object; return $__raw_object; } my %import_param = ( %new_param, 'Prefix' => { type => SCALAR, optional => 1, regexp => qr/^[[:alpha:]\d]\w*$/ }, '__Prefix' => { type => SCALAR, optional => 1, regexp => qr/^[[:alpha:]\d]\w*$/ }, '__Suffix' => { type => SCALAR, optional => 1, regexp => qr/^\w+$/ }, ); my %import_param_names = map { ($_=>1) } keys %import_param; sub import { my $pkg = shift; if(!@_ || !exists $import_param_names{$_[0]}) { local $Exporter::ExportLevel; $Exporter::ExportLevel++; return Exporter::import($pkg, @_); } return __import(scalar caller(0),@_) ? 1 : 0; } sub __import { my $pkg = shift; validate(@_, \%import_param); my %param = @_; my $std_prefix = (exists $param{'Prefix'}) ? $param{'Prefix'} : 'color'; delete $param{'Prefix'}; my $prefix = (exists $param{'__Prefix'}) ? $param{'__Prefix'} : $std_prefix ? $std_prefix.'_' : ''; delete $param{'__Prefix'}; my $suffix = (exists $param{'__Suffix'}) ? $param{'__Suffix'} : ''; delete $param{'__Suffix'}; my $obj = new(__PACKAGE__, %param); { no strict 'refs'; { $prefix = $pkg.'::'.$prefix; foreach my $sub (@__subs) { my $name = $prefix.$sub.$suffix; *$name = sub { $obj->$sub(@_); }; }; }; if($std_prefix) { my $name = $pkg.'::'.$std_prefix.$suffix; *$name = sub { $obj->get(@_); }; } } return 1; } sub __dualvar_tuple { my $str = shift; my $num = reduce { ($a << 8) | ($b & 0xFF) } @_; return dualvar $num, $str; } sub __normtuple_in { return map { (!defined($_) || $_ < 0) ? 0 : (($_ > 255) ? 255 : int($_+.5)) } @_; } sub __is_col_val { return undef unless defined $_[0]; return undef if $_[0] eq ''; my ($n,$u) = POSIX::strtod($_[0]); return undef if $u != 0; return ($n <= 255) && ($n>= 0); } # Note: Color::Object was supported in versions before 0.2. This # is kept for compatibility, but no longer documented. # # Note: versions before 0.2 allowed calling some functions (those # with one parameter) with a list instead of an arrayref. This is # kept for compatibility, but no longer documented. sub __get { my ($self,$p,$q) = @_; if ((ref $$p[0]) eq 'ARRAY' && $#{$$p[0]} == 0 ) { $$p[0] = $$p[0]->[0]; } if ((ref $$p[0]) eq 'ARRAY' && $#{$$p[0]} == 2 ) { return __normtuple_in(@{shift @$p}); } elsif( my $f255 = UNIVERSAL::can($$p[0],'asRGB255') || UNIVERSAL::can($$p[0],'as_RGB255') ) { return ($f255->(shift(@{$p}))); } elsif( my $f1 = UNIVERSAL::can($$p[0],'asRGB') || UNIVERSAL::can($$p[0],'as_RGB') ) { return (map { 255 * $_; } $f1->(shift(@{$p}))); } elsif( $#$p >= (2 + ($q||0)) && __is_col_val($$p[0]) && __is_col_val($$p[1]) && __is_col_val($$p[2])) { return (splice @$p, 0, 3); } elsif( $$p[0] =~ m/^#?(([0-9A-F][0-9A-F][0-9A-F])+)$/i ) { shift @$p; my $hh = $1; my $hl = (length $hh)/3; return map { hex($_) * 255.0 / hex('F' x $hl) } (substr($hh,0,$hl), substr($hh,$hl,$hl), substr($hh,2*$hl)); } else { my $col = $self->{'ColorScheme'}->{$$p[0]}; if(defined $col) { shift @$p; return hex2tuple($col); } else { carp("Invalid color name '$$p[0]'"); return undef; } } } sub __require_format { my $new_fmt = shift; if(exists $__formats_require{$new_fmt}) { eval "use $__formats_require{$new_fmt}()"; croak $@ if $@; } return 1; } sub set_output_format { validate_pos(@_, { isa => __PACKAGE__ }, { type => SCALAR, regexp => qr($__formats_re) }); my $self = shift; my $new_fmt = shift; my $old = $self->{'OutputFormat'}; $self->{'OutputFormat'} = $new_fmt; $self->{'__put'} = $self->{'OutputFormat'} eq '__MODEvar' ? sub{ return $__formats{$MODE || 'tuple'}->(@_); } : $__formats{$self->{'OutputFormat'}}; return $old; } sub __put { my $self = shift; return $self->{'__put'}->(__normtuple_in(@_)); } sub __get_self { if(UNIVERSAL::isa($_[0]->[0], __PACKAGE__)) { return shift @{$_[0]}; } else { return __get_default; } } =head1 NAME Color::Calc - Simple calculations with RGB colors. =head1 SYNOPSIS use Color::Calc (); my $background = 'green'; print 'background: ',Color::Calc::color_html($background),";\n"; print 'border-top: solid 1px ',Color::Calc::light_html($background),";\n"; print 'border-bottom: solid 1px ',Color::Calc::dark_html($background),";\n"; print 'color: ',Color::Calc::contrast_bw_html($background),";\n"; =head1 DESCRIPTION The C module implements simple calculations with RGB colors. This can be used to create a full color scheme from a few colors. =head2 USAGE =head3 Constructors =over =item Color::Calc->new( ... ) This class method creates a new C object. use Color::Calc(); my $cc = new Color::Calc( 'ColorScheme' => 'X', OutputFormat => 'HTML' ); print $cc->invert( 'white' ); It accepts the following parameters: =over =item ColorScheme One of the color schemes accepted by C, which is used to interpret color names on input. Valid values include C (color names used in X-Windows) and C (color names defined in the HTML 4.0 specification). For a full list of possible values, please refer to the documentation of of C. Unlike C, barewords are I interpreted as a module name under C. If you really want to use a filename like "foo", you have to write it as "./foo". Default: C (Note: This is incompatible with HTML color names). =item OutputFormat One of the output formats defined by this module. Possible values are: =over =item tuple Returns a list of three values in the range 0..255. The first value is guaranteed to have a C that is not a multiple of three. =item hex Returns a hexadecimal RGB value as a scalar that contains a string in the format RRGGBB and a number representing the hexadecimal number 0xRRGGBB. =item html Returns a string compatible with W3C's HTML and CSS specifications, i.e. I<#RRGGBB> or one of the sixteen HTML color names. =item obj (DEPRECATED) Returns a C reference. The module C must be installed, of course. =item object Returns a C reference. The module C must be installed, of course. =item pdf Returns a string compatible with C, i.e. I<#RRGGBB>. =item __MODEvar (DEPRECATED) Uses the value of C<$Color::Calc::MODE> to select one of the above output formats. You should use C when setting this variable: local $Color::Calc::MODE = 'html'; =back Default: C<__MODEvar> (for compatibility) =back =item Color::Calc->import( ... ) This method creates a new, hidden object and binds its methods to the namespace of the calling module. This method is usually not called directly but from perl's C statement: use Color::Calc( 'ColorScheme' => 'X', 'OutputFormat' => 'HTML', 'Prefix' => 'cc' ); print cc_invert( 'white' ); # prints 'black' On import, you can specify the following parameters: =over =item ColorScheme See above. =item OutputFormat See above. =item Prefix Adds a prefix to the front of the method names. The calculation methods are bound to the name I_I (the specified prefix, an underscore, the calculation method's name). Further, I is made an alias for IC<_get>. Default: C =back Please note that with perl's C and C statemehts, omitting the list and specifying an empty list has different meanings: use Color::Calc; # import with default settings (see below) use Color::Calc(); # don't import anything =back =head3 Property "set"/"get" methods These methods are inaccessible without a object reference, i.e. when the functions have been Ced. =over =item $cc->set_output_format( $format) Changes the output format for an existing C object. =back =head3 Calculation methods All calculation methods I accept the following formats for C<$color> or C<$color1>/C<$color2>: =over =item * An arrayref pointing to an array with three elements in the range C<0>..C<255> corresponding to the red, green, and blue component. =item * A list of three values in the range C<0>..C<255> corresponding to the red, green, and blue component where the first value does not have 3 or a multiple of 3 digits (e.g. C<('0128',128,128)>). =item * A string containing a hexadecimal RGB value like C<#I>/C<#I>/C<#I>/..., or C>/C>/C>/... =item * A color name accepted by C. The interpretation is controlled by the C parameter. =item * A C reference. =back The calculation methods can be either accessed through a C object reference (here: C<$cc>) or through the method names imported by C (here using the prefix L). =over =item $cc->get($color) / color($color) Returns C<$color> as-is (but in the selected output format). This function can be used for color format conversion/normalisation. =cut sub get { my $self = __get_self(\@_); return $self->__put($self->__get(\@_)); } =item $cc->invert($color) / color_invert($color) Returns the inverse of C<$color>. =cut sub invert { my $self = __get_self(\@_); return $self->__put(map { 255 - $_ } $self->__get(\@_)); } =item $cc->opposite($color) / color_opposite($color) Returns a color that is on the opposite side of the color wheel but roughly keeps the saturation and lightness. =cut sub opposite { my $self = __get_self(\@_); my @rgb = $self->__get(\@_); my $min = min @rgb; my $max = max @rgb; return $self->__put( map { $max - $_ + $min } @rgb ); } =item $cc->bw($color) / color_bw($color) =item $cc->grey($color) / color_grey($color) =item $cc->gray($color) / color_gray($color) Converts C<$color> to greyscale. =cut sub bw { my $self = __get_self(\@_); my @c = $self->__get(\@_); my $g = $c[0]*.3 + $c[1]*.59 + $c[2]*.11; return $self->__put($g, $g, $g); } *grey = \&bw; *gray = \&bw; =item $cc->round($color, $value_count) / color_round($color, $value_count) Rounds each component to to the nearest number determined by dividing the range 0..255 into C<$value_count>+1 portions. The default for C<$value_count> is 6, yielding S<6^3 = 216> colors. Values that are one higher than divisors of 255 yield the best results (e.g. 3+1, 5+1, 7+1, 9+1, 15+1, 17+1, ...). =cut sub round { my $self = __get_self(\@_); my @rgb = $self->__get(\@_); my $steps = shift || 6; $steps--; return $self->__put( map { int(int( $_ * $steps / 255 + 0.5) * 255 / $steps + 0.5) } @rgb ); } =item $cc->safe($color) / color_safe($color) Rounds each color component to a multiple of 0x33 (dec. 51) or to a named color defined in the HTML 4.01 specification. Historically, these colors have been known as web-safe colors. They still provide a convenient color palette. =cut sub __dist2 { my @a = splice @_, 0, 3; return sum map { POSIX::pow($_ - shift @a, 2) } @_; } sub safe { my $self = __get_self(\@_); my @rgb = $self->__get(\@_); my @new_rgb = __get_raw->round(@rgb); my $new_d2 = __dist2(@rgb, @new_rgb); foreach my $h (keys %__HTMLColors) { my @h_rgb = hex2tuple($h); my $h_d2 = __dist2(@rgb, @h_rgb); if($h_d2 <= $new_d2) { @new_rgb = @h_rgb; $new_d2 = $h_d2; } } return $self->__put(@new_rgb); } =item $cc->mix($color1, $color2 [, $alpha]) / color_mix($color1, $color2 [, $alpha]) Returns a color that is the mixture of C<$color1> and C<$color2>. The optional C<$alpha> parameter can be a value between 0.0 (use C<$color1> only) and 1.0 (use C<$color2> only), the default is 0.5. =cut sub mix { my $self = __get_self(\@_); my @c1 = ($self->__get(\@_,1)); my @c2 = ($self->__get(\@_)); my $alpha = shift(@_); $alpha = 0.5 unless defined $alpha; return $self->__put( ($c1[0] + ($c2[0]-$c1[0])*$alpha), ($c1[1] + ($c2[1]-$c1[1])*$alpha), ($c1[2] + ($c2[2]-$c1[2])*$alpha) ); } =item $cc->light($color [, $alpha]) / color_light($color [, $alpha]) Returns a lighter version of C<$color>, i.e. returns C. The optional C<$alpha> parameter can be a value between 0.0 (use C<$color> only) and 1.0 (use [255,255,255] only), the default is 0.5. =cut sub light { my $self = __get_self(\@_); return $self->__put(__get_raw->mix([$self->__get(\@_)],[255,255,255],shift)); } =item $cc->dark($color [, $alpha]) / color_dark($color [, $alpha]) Returns a darker version of C<$color>, i.e. returns C. The optional C<$alpha> parameter can be a value between 0.0 (use C<$color> only) and 1.0 (use [0,0,0] only), the default is 0.5. =cut sub dark { my $self = __get_self(\@_); return $self->__put(__get_raw->mix([$self->__get(\@_)],[0,0,0],shift)); } =item $cc->contrast($color [, $cut]) / color_contrast($color [, $cut]) Returns a color that has the highest possible contrast to the input color. This is done by setting the red, green, and blue values to 0 if the corresponding value in the input is above C<($cut * 255)> and to 255 otherwise. The default for C<$cut> is .5, representing a cutoff between 127 and 128. =cut sub contrast { my $self = __get_self(\@_); my @rgb = $self->__get(\@_); my $cut = (shift || .5) * 255; return $self->__put(map { $_ >= $cut ? 0 : 255 } @rgb); } =item $cc->contrast_bw($color [, $cut]) / color_contrast_bw($color [, $cut]) Returns black or white, whichever has the higher contrast to C<$color>. This is done by returning black if the grey value of C<$color> is above C<($cut * 255)> and white otherwise. The default for C<$cut> is .5, representing a cutoff between 127 and 128. =cut sub contrast_bw { my $self = __get_self(\@_); my @rgb = $self->__get(\@_); return $self->__put(__get_raw->contrast([__get_raw->bw(@rgb)], shift)); } =item $cc->blend($color [, $alpha]) / color_blend($color [, $alpha]) Returns a color that blends into the background, i.e. it returns C. The optional C<$alpha> parameter can be a value between 0.0 (use C<$color> only) and 1.0 (use C only), the default is 0.5. The idea is that C<$color> is the foreground color, so C is similar to the background color. Mixing them returns a color somewhere between them. You might want to use C instead if you know the real background color. =cut sub blend { my $self = __get_self(\@_); my @c1 = $self->__get(\@_); return $self->mix(\@c1,[__get_raw->contrast(\@c1)],shift); } =item $cc->blend_bw($color [, $alpha]) / color_blend_bw($color [, $alpha]) Returns a mix of C<$color> and black or white, whichever has the higher contrast to C<$color>. The optional C<$alpha> parameter can be a value between 0.0 (use C<$color> only) and 1.0 (use black/white only), the default is 0.5. =cut sub blend_bw { my $self = __get_self(\@_); my @c = $self->__get(\@_); return $self->mix(\@c,[__get_raw->contrast_bw(\@c)],shift); } =back =head3 Functions The calculation methods are also available as functions. The output format is selected through the function name. These functions are deprecated as they do not allow selecting the scheme of recognized color names, which defaults to L (and is incompatible with HTML's color names). By default, i.e. when no list is specified with C or C, all of these functions are exported. =over =item color, color_mix, ... Use C<$Color::Calc::MODE> as the output format. This is the default. =item color_hex, color_mix_html, ... Use C as the output format. =item color_html, color_mix_html, ... Use C as the output format. Please note that the color names recognized are still based on X's color names, which are incompatible with HTML. You can't use the output of these functions as input for other color_*_html functions. See L for an alternative that does not suffer from this problem. =item color_pdf, color_mix_pdf, ... Use C as the output format. =item color_object, color_mix_object, ... Use C as the output format. =back =cut foreach my $format (@__formats) { next if !eval{__require_format($format)}; __import(__PACKAGE__, 'Prefix' => 'color', '__Suffix' => "_$format", 'OutputFormat' => $format); __import(__PACKAGE__, 'Prefix' => '', '__Suffix' => "_$format", 'OutputFormat' => $format); } __import(__PACKAGE__, 'Prefix' => 'color', 'OutputFormat' => '__MODEvar'); =head1 SEE ALSO L (required); L (optional) =head1 AUTHOR Claus FErber =head1 LICENSE Copyright 2004-2010 Claus FErber. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; __END__ Color-Calc-1.074/lib/Color/Calc000755000765000024 012411507274 16171 5ustar00cfaerberstaff000000000000Color-Calc-1.074/lib/Color/Calc/WWW.pm000444000765000024 341612411507274 17354 0ustar00cfaerberstaff000000000000package Color::Calc::WWW; use strict; use utf8; use warnings; use Carp; use Exporter; use Color::Calc( 'OutputFormat' => 'html', 'ColorScheme' => 'WWW' ); our $VERSION = "1.073"; $VERSION = eval $VERSION; our @ISA = qw(Exporter); our @EXPORT = ('color', map { 'color_'.$_ } @Color::Calc::__subs); 1; __END__ =head1 NAME Color::Calc::WWW - Simple calculations with colors for the WWW. =head1 SYNOPSIS use Color::Calc::WWW; my $background = 'green'; print 'background: ', color($background),';'; print 'border-top: solid 1px ', color_light($background),';'; print 'border-bottom: solid 1px ', color_dark($background),';'; print 'color: ', color_contrast_bw($background),';'; =head1 DESCRIPTION The C module implements simple calculations with RGB colors for the World Wide Web. This can be used to create a full color scheme from a few colors. This module is nearly identical to using the following: use Color::Calc('ColorScheme' => 'WWW', 'OutputFormat' => 'html'); However, this module also makes the functions available when not imported: use Color::Calc::WWW(); # don't import Color::Calc::WWW::color('F00'); =head1 USAGE By default, all functions are imported. All functions recognize all HTML color keywords (through L) and output the results in WWW-compatible formats, i.e. as one of the 16 basic HTML keywords (see L) or as #RRGGBB. =over =item color, color_mix, ... See L for a list of available calculation functions. =back =head1 NOTE =head1 AUTHOR Claus FErber =head1 LICENSE Copyright 2004-2010 Claus FErber. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Color-Calc-1.074/t000755000765000024 012411507274 13746 5ustar00cfaerberstaff000000000000Color-Calc-1.074/t/00basic.t000444000765000024 20012411507274 15461 0ustar00cfaerberstaff000000000000use Test::More tests => 3; use Test::NoWarnings; use_ok('Color::Calc'); my $cc = new Color::Calc; isa_ok($cc, 'Color::Calc'); Color-Calc-1.074/t/10pod.t000444000765000024 21712411507274 15173 0ustar00cfaerberstaff000000000000use strict; use Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Color-Calc-1.074/t/11pod_cover.t000444000765000024 61012411507274 16367 0ustar00cfaerberstaff000000000000use strict; use Test::More; eval "use Test::Pod::Coverage;"; plan skip_all => "Test::Pod::Coverage required for testing POD coverage" if $@; plan tests => 2; pod_coverage_ok( 'Color::Calc', { trustme => [ qr/_(tuple|html|pdf|hex|obj|object)$/, qr/^color(_.+)?$/ ], }, 'Color::Calc is covered by POD' ); pod_coverage_ok( 'Color::Calc::WWW', 'Color::Calc::WWW is covered by POD' ); Color-Calc-1.074/t/color_opposite.t000444000765000024 136212411507274 17332 0ustar00cfaerberstaff000000000000use Test::More tests => 16; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'hex', 'ColorScheme' => 'WWW' ); is( color_opposite('black'), '000000' ); is( color_opposite('white'), 'ffffff' ); is( color_opposite('008000'), '800080' ); is( color_opposite('800000'), '008080' ); is( color_opposite('000080'), '808000' ); is( color_opposite('008080'), '800000' ); is( color_opposite('800080'), '008000' ); is( color_opposite('808000'), '000080' ); is( color_opposite('22cc22'), 'cc22cc' ); is( color_opposite('cc2222'), '22cccc' ); is( color_opposite('2222cc'), 'cccc22' ); is( color_opposite('66ffff'), 'ff6666' ); is( color_opposite('ff66ff'), '66ff66' ); is( color_opposite('ffff66'), '6666ff' ); is( color_opposite('#3247CF'), 'cfba32' ); Color-Calc-1.074/t/color_round.t000444000765000024 117412411507274 16620 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'hex', 'ColorScheme' => 'WWW' ); is( color_round('black'), '000000' ); is( color_round('white'), 'ffffff' ); is( color_round('green'), '009900' ); is( color_round('maroon'), '990000' ); is( color_round('silver'), 'cccccc' ); is( color_round('#c6c6c6'), 'cccccc' ); is( color_round('#c7c7c7'), 'cccccc' ); is( color_round('#222222'), '333333' ); is( color_round('#808080'), '999999' ); is( color_round('#DDDDDD'), 'cccccc' ); is( color_round('#AABBEE'), '99ccff' ); is( color_round('#08FC23'), '00ff33' ); is( color_round('#3247CF'), '3333cc' ); Color-Calc-1.074/t/color_safe.t000444000765000024 115712411507274 16410 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'hex', 'ColorScheme' => 'WWW' ); is( color_safe('black'), '000000' ); is( color_safe('white'), 'ffffff' ); is( color_safe('green'), '008000' ); is( color_safe('maroon'), '800000' ); is( color_safe('silver'), 'c0c0c0' ); is( color_safe('#c6c6c6'), 'c0c0c0' ); is( color_safe('#c7c7c7'), 'cccccc' ); is( color_safe('#222222'), '333333' ); is( color_safe('#8F807F'), '808080' ); is( color_safe('#808080'), '808080' ); is( color_safe('#AABBEE'), '99ccff' ); is( color_safe('#08FC23'), '00ff33' ); is( color_safe('#3247CF'), '3333cc' ); Color-Calc-1.074/t/DEPRECATED_import_MODEval.t000444000765000024 506112411507274 20573 0ustar00cfaerberstaff000000000000use Test::More tests => 53; use Test::NoWarnings; use Color::Calc; local $Color::Calc::MODE = 'hex'; is(color_get ('red'), 'ff0000'); is(color ('red'), 'ff0000'); is(color_mix ('red','blue'), '800080'); is(color_blend_bw ('red'), 'ff8080'); is(color_blend ('red'), '808080'); is(color_bw ('red'), '4d4d4d'); is(color_contrast_bw ('red'), 'ffffff'); is(color_contrast ('red'), '00ffff'); is(color_dark ('red'), '800000'); is(color_gray ('red'), '4d4d4d'); is(color_grey ('red'), '4d4d4d'); is(color_invert ('red'), '00ffff'); is(color_light ('red'), 'ff8080'); local $Color::Calc::MODE = 'html'; is(color_get ('F00'), 'red'); is(color ('F00'), 'red'); is(color_mix ('red','blue'), 'purple'); is(color_blend_bw ('red'), '#ff8080'); is(color_blend ('red'), 'gray'); is(color_bw ('red'), '#4d4d4d'); is(color_contrast_bw ('red'), 'white'); is(color_contrast ('red'), 'aqua'); is(color_dark ('red'), 'maroon'); is(color_gray ('red'), '#4d4d4d'); is(color_grey ('red'), '#4d4d4d'); is(color_invert ('red'), 'aqua'); is(color_light ('red'), '#ff8080'); local $Color::Calc::MODE = 'object'; SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 13 if $@; is(lc color_get ('red')->as_RGBhex, 'ff0000'); is(lc color ('red')->as_RGBhex, 'ff0000'); is(lc color_mix ('red','blue')->as_RGBhex, '800080'); is(lc color_blend_bw ('red')->as_RGBhex, 'ff8080'); is(lc color_blend ('red')->as_RGBhex, '808080'); is(lc color_bw ('red')->as_RGBhex, '4d4d4d'); is(lc color_contrast_bw ('red')->as_RGBhex, 'ffffff'); is(lc color_contrast ('red')->as_RGBhex, '00ffff'); is(lc color_dark ('red')->as_RGBhex, '800000'); is(lc color_gray ('red')->as_RGBhex, '4d4d4d'); is(lc color_grey ('red')->as_RGBhex, '4d4d4d'); is(lc color_invert ('red')->as_RGBhex, '00ffff'); is(lc color_light ('red')->as_RGBhex, 'ff8080'); } local $Color::Calc::MODE = 'tuple'; is(join(',',color_get ('red')), '0255,0,0'); is(join(',',color ('red')), '0255,0,0'); is(join(',',color_mix ('red','blue')), '0128,0,0128'); is(join(',',color_blend_bw ('red')), '0255,0128,0128'); is(join(',',color_blend ('red')), '0128,0128,0128'); is(join(',',color_bw ('red')), '77,77,77'); is(join(',',color_contrast_bw ('red')), '0255,0255,0255'); is(join(',',color_contrast ('red')), '0,0255,0255'); is(join(',',color_dark ('red')), '0128,0,0'); is(join(',',color_gray ('red')), '77,77,77'); is(join(',',color_grey ('red')), '77,77,77'); is(join(',',color_invert ('red')), '0,0255,0255'); is(join(',',color_light ('red')), '0255,0128,0128'); Color-Calc-1.074/t/DEPRECATED_import_suffix.t000444000765000024 531512411507274 20652 0ustar00cfaerberstaff000000000000use Test::More tests => 53; use Test::NoWarnings; use Color::Calc; is(color_get_hex ('red'), 'ff0000'); is(color_hex ('red'), 'ff0000'); is(color_mix_hex ('red','blue'), '800080'); is(color_blend_bw_hex ('red'), 'ff8080'); is(color_blend_hex ('red'), '808080'); is(color_bw_hex ('red'), '4d4d4d'); is(color_contrast_bw_hex ('red'), 'ffffff'); is(color_contrast_hex ('red'), '00ffff'); is(color_dark_hex ('red'), '800000'); is(color_gray_hex ('red'), '4d4d4d'); is(color_grey_hex ('red'), '4d4d4d'); is(color_invert_hex ('red'), '00ffff'); is(color_light_hex ('red'), 'ff8080'); is(color_get_html ('F00'), 'red'); is(color_html ('F00'), 'red'); is(color_mix_html ('red','blue'), 'purple'); is(color_blend_bw_html ('red'), '#ff8080'); is(color_blend_html ('red'), 'gray'); is(color_bw_html ('red'), '#4d4d4d'); is(color_contrast_bw_html ('red'), 'white'); is(color_contrast_html ('red'), 'aqua'); is(color_dark_html ('red'), 'maroon'); is(color_gray_html ('red'), '#4d4d4d'); is(color_grey_html ('red'), '#4d4d4d'); is(color_invert_html ('red'), 'aqua'); is(color_light_html ('red'), '#ff8080'); SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 13 if $@; is(lc color_get_object ('red')->as_RGBhex, 'ff0000'); is(lc color_object ('red')->as_RGBhex, 'ff0000'); is(lc color_mix_object ('red','blue')->as_RGBhex, '800080'); is(lc color_blend_bw_object ('red')->as_RGBhex, 'ff8080'); is(lc color_blend_object ('red')->as_RGBhex, '808080'); is(lc color_bw_object ('red')->as_RGBhex, '4d4d4d'); is(lc color_contrast_bw_object ('red')->as_RGBhex, 'ffffff'); is(lc color_contrast_object ('red')->as_RGBhex, '00ffff'); is(lc color_dark_object ('red')->as_RGBhex, '800000'); is(lc color_gray_object ('red')->as_RGBhex, '4d4d4d'); is(lc color_grey_object ('red')->as_RGBhex, '4d4d4d'); is(lc color_invert_object ('red')->as_RGBhex, '00ffff'); is(lc color_light_object ('red')->as_RGBhex, 'ff8080'); } is(join(',',color_get_tuple ('red')), '0255,0,0'); is(join(',',color_tuple ('red')), '0255,0,0'); is(join(',',color_mix_tuple ('red','blue')), '0128,0,0128'); is(join(',',color_blend_bw_tuple ('red')), '0255,0128,0128'); is(join(',',color_blend_tuple ('red')), '0128,0128,0128'); is(join(',',color_bw_tuple ('red')), '77,77,77'); is(join(',',color_contrast_bw_tuple ('red')), '0255,0255,0255'); is(join(',',color_contrast_tuple ('red')), '0,0255,0255'); is(join(',',color_dark_tuple ('red')), '0128,0,0'); is(join(',',color_gray_tuple ('red')), '77,77,77'); is(join(',',color_grey_tuple ('red')), '77,77,77'); is(join(',',color_invert_tuple ('red')), '0,0255,0255'); is(join(',',color_light_tuple ('red')), '0255,0128,0128'); Color-Calc-1.074/t/DEPRECATED_non-import_MODEval.t000444000765000024 536012411507274 21365 0ustar00cfaerberstaff000000000000use Test::More tests => 49; use Test::NoWarnings; use Color::Calc(); local $Color::Calc::MODE = 'hex'; is(Color::Calc::get ('red'), 'ff0000'); is(Color::Calc::mix ('red','blue'), '800080'); is(Color::Calc::blend_bw ('red'), 'ff8080'); is(Color::Calc::blend ('red'), '808080'); is(Color::Calc::bw ('red'), '4d4d4d'); is(Color::Calc::contrast_bw ('red'), 'ffffff'); is(Color::Calc::contrast ('red'), '00ffff'); is(Color::Calc::dark ('red'), '800000'); is(Color::Calc::gray ('red'), '4d4d4d'); is(Color::Calc::grey ('red'), '4d4d4d'); is(Color::Calc::invert ('red'), '00ffff'); is(Color::Calc::light ('red'), 'ff8080'); local $Color::Calc::MODE = 'html'; is(Color::Calc::get ('F00'), 'red'); is(Color::Calc::mix ('red','blue'), 'purple'); is(Color::Calc::blend_bw ('red'), '#ff8080'); is(Color::Calc::blend ('red'), 'gray'); is(Color::Calc::bw ('red'), '#4d4d4d'); is(Color::Calc::contrast_bw ('red'), 'white'); is(Color::Calc::contrast ('red'), 'aqua'); is(Color::Calc::dark ('red'), 'maroon'); is(Color::Calc::gray ('red'), '#4d4d4d'); is(Color::Calc::grey ('red'), '#4d4d4d'); is(Color::Calc::invert ('red'), 'aqua'); is(Color::Calc::light ('red'), '#ff8080'); local $Color::Calc::MODE = 'object'; SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 12 if $@; is(lc Color::Calc::get ('red')->as_RGBhex, 'ff0000'); is(lc Color::Calc::mix ('red','blue')->as_RGBhex, '800080'); is(lc Color::Calc::blend_bw ('red')->as_RGBhex, 'ff8080'); is(lc Color::Calc::blend ('red')->as_RGBhex, '808080'); is(lc Color::Calc::bw ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::contrast_bw ('red')->as_RGBhex, 'ffffff'); is(lc Color::Calc::contrast ('red')->as_RGBhex, '00ffff'); is(lc Color::Calc::dark ('red')->as_RGBhex, '800000'); is(lc Color::Calc::gray ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::grey ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::invert ('red')->as_RGBhex, '00ffff'); is(lc Color::Calc::light ('red')->as_RGBhex, 'ff8080'); } local $Color::Calc::MODE = 'tuple'; is(join(',',Color::Calc::get ('red')), '0255,0,0'); is(join(',',Color::Calc::mix ('red','blue')), '0128,0,0128'); is(join(',',Color::Calc::blend_bw ('red')), '0255,0128,0128'); is(join(',',Color::Calc::blend ('red')), '0128,0128,0128'); is(join(',',Color::Calc::bw ('red')), '77,77,77'); is(join(',',Color::Calc::contrast_bw ('red')), '0255,0255,0255'); is(join(',',Color::Calc::contrast ('red')), '0,0255,0255'); is(join(',',Color::Calc::dark ('red')), '0128,0,0'); is(join(',',Color::Calc::gray ('red')), '77,77,77'); is(join(',',Color::Calc::grey ('red')), '77,77,77'); is(join(',',Color::Calc::invert ('red')), '0,0255,0255'); is(join(',',Color::Calc::light ('red')), '0255,0128,0128'); Color-Calc-1.074/t/DEPRECATED_non-import_suffix.t000444000765000024 557312411507274 21450 0ustar00cfaerberstaff000000000000use Test::More tests => (12*4) + 1; use Test::NoWarnings; use Color::Calc(); is(Color::Calc::get_hex ('red'), 'ff0000'); is(Color::Calc::mix_hex ('red','blue'), '800080'); is(Color::Calc::blend_bw_hex ('red'), 'ff8080'); is(Color::Calc::blend_hex ('red'), '808080'); is(Color::Calc::bw_hex ('red'), '4d4d4d'); is(Color::Calc::contrast_bw_hex ('red'), 'ffffff'); is(Color::Calc::contrast_hex ('red'), '00ffff'); is(Color::Calc::dark_hex ('red'), '800000'); is(Color::Calc::gray_hex ('red'), '4d4d4d'); is(Color::Calc::grey_hex ('red'), '4d4d4d'); is(Color::Calc::invert_hex ('red'), '00ffff'); is(Color::Calc::light_hex ('red'), 'ff8080'); is(Color::Calc::get_html ('F00'), 'red'); is(Color::Calc::mix_html ('red','blue'), 'purple'); is(Color::Calc::blend_bw_html ('red'), '#ff8080'); is(Color::Calc::blend_html ('red'), 'gray'); is(Color::Calc::bw_html ('red'), '#4d4d4d'); is(Color::Calc::contrast_bw_html ('red'), 'white'); is(Color::Calc::contrast_html ('red'), 'aqua'); is(Color::Calc::dark_html ('red'), 'maroon'); is(Color::Calc::gray_html ('red'), '#4d4d4d'); is(Color::Calc::grey_html ('red'), '#4d4d4d'); is(Color::Calc::invert_html ('red'), 'aqua'); is(Color::Calc::light_html ('red'), '#ff8080'); SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 12 if $@; is(lc Color::Calc::get_object ('red')->as_RGBhex, 'ff0000'); is(lc Color::Calc::mix_object ('red','blue')->as_RGBhex, '800080'); is(lc Color::Calc::blend_bw_object ('red')->as_RGBhex, 'ff8080'); is(lc Color::Calc::blend_object ('red')->as_RGBhex, '808080'); is(lc Color::Calc::bw_object ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::contrast_bw_object ('red')->as_RGBhex, 'ffffff'); is(lc Color::Calc::contrast_object ('red')->as_RGBhex, '00ffff'); is(lc Color::Calc::dark_object ('red')->as_RGBhex, '800000'); is(lc Color::Calc::gray_object ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::grey_object ('red')->as_RGBhex, '4d4d4d'); is(lc Color::Calc::invert_object ('red')->as_RGBhex, '00ffff'); is(lc Color::Calc::light_object ('red')->as_RGBhex, 'ff8080'); } is(join(',',Color::Calc::get_tuple ('red')), '0255,0,0'); is(join(',',Color::Calc::mix_tuple ('red','blue')), '0128,0,0128'); is(join(',',Color::Calc::blend_bw_tuple ('red')), '0255,0128,0128'); is(join(',',Color::Calc::blend_tuple ('red')), '0128,0128,0128'); is(join(',',Color::Calc::bw_tuple ('red')), '77,77,77'); is(join(',',Color::Calc::contrast_bw_tuple ('red')), '0255,0255,0255'); is(join(',',Color::Calc::contrast_tuple ('red')), '0,0255,0255'); is(join(',',Color::Calc::dark_tuple ('red')), '0128,0,0'); is(join(',',Color::Calc::gray_tuple ('red')), '77,77,77'); is(join(',',Color::Calc::grey_tuple ('red')), '77,77,77'); is(join(',',Color::Calc::invert_tuple ('red')), '0,0255,0255'); is(join(',',Color::Calc::light_tuple ('red')), '0255,0128,0128'); Color-Calc-1.074/t/import_hex.t000444000765000024 110712411507274 16445 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'hex' ); is(color_get ('red'), 'ff0000'); is(color ('red'), 'ff0000'); is(color_mix ('red','blue'), '800080'); is(color_blend_bw ('red'), 'ff8080'); is(color_blend ('red'), '808080'); is(color_bw ('red'), '4d4d4d'); is(color_contrast_bw ('red'), 'ffffff'); is(color_contrast ('red'), '00ffff'); is(color_dark ('red'), '800000'); is(color_gray ('red'), '4d4d4d'); is(color_grey ('red'), '4d4d4d'); is(color_invert ('red'), '00ffff'); is(color_light ('red'), 'ff8080'); Color-Calc-1.074/t/import_html.t000444000765000024 110012411507274 16616 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'html' ); is(color_get ('F00'), 'red'); is(color ('F00'), 'red'); is(color_mix ('red','blue'), 'purple'); is(color_blend_bw ('red'), '#ff8080'); is(color_blend ('red'), 'gray'); is(color_bw ('red'), '#4d4d4d'); is(color_contrast_bw ('red'), 'white'); is(color_contrast ('red'), 'aqua'); is(color_dark ('red'), 'maroon'); is(color_gray ('red'), '#4d4d4d'); is(color_grey ('red'), '#4d4d4d'); is(color_invert ('red'), 'aqua'); is(color_light ('red'), '#ff8080'); Color-Calc-1.074/t/import_MODEval.t000444000765000024 506612411507274 17120 0ustar00cfaerberstaff000000000000use Test::More tests => 53; use Test::NoWarnings; use Color::Calc; local $Color::Calc::MODE = 'hex'; is(color_get ('red'), 'ff0000'); is(color ('red'), 'ff0000'); is(color_mix ('red','blue'), '800080'); is(color_blend_bw ('red'), 'ff8080'); is(color_blend ('red'), '808080'); is(color_bw ('red'), '4d4d4d'); is(color_contrast_bw ('red'), 'ffffff'); is(color_contrast ('red'), '00ffff'); is(color_dark ('red'), '800000'); is(color_gray ('red'), '4d4d4d'); is(color_grey ('red'), '4d4d4d'); is(color_invert ('red'), '00ffff'); is(color_light ('red'), 'ff8080'); local $Color::Calc::MODE = 'html'; is(color_get ('F00'), 'red'); is(color ('F00'), 'red'); is(color_mix ('red','blue'), 'purple'); is(color_blend_bw ('red'), '#ff8080'); is(color_blend ('red'), 'gray'); is(color_bw ('red'), '#4d4d4d'); is(color_contrast_bw ('red'), 'white'); is(color_contrast ('red'), 'aqua'); is(color_dark ('red'), 'maroon'); is(color_gray ('red'), '#4d4d4d'); is(color_grey ('red'), '#4d4d4d'); is(color_invert ('red'), 'aqua'); is(color_light ('red'), '#ff8080'); local $Color::Calc::MODE = 'object'; SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 13 if $@; is(lc color_get ('red')->as_RGBhex, 'ff0000'); is(lc color ('red')->as_RGBhex, 'ff0000'); is(lc color_mix ('red','blue')->as_RGBhex, '800080'); is(lc color_blend_bw ('red')->as_RGBhex, 'ff8080'); is(lc color_blend ('red')->as_RGBhex, '808080'); is(lc color_bw ('red')->as_RGBhex, '4d4d4d'); is(lc color_contrast_bw ('red')->as_RGBhex, 'ffffff'); is(lc color_contrast ('red')->as_RGBhex, '00ffff'); is(lc color_dark ('red')->as_RGBhex, '800000'); is(lc color_gray ('red')->as_RGBhex, '4d4d4d'); is(lc color_grey ('red')->as_RGBhex, '4d4d4d'); is(lc color_invert ('red')->as_RGBhex, '00ffff'); is(lc color_light ('red')->as_RGBhex, 'ff8080'); } local $Color::Calc::MODE = 'tuple'; is(join(',',color_get ('red')), '0255,0,0'); is(join(',',color ('red')), '0255,0,0'); is(join(',',color_mix ('red','blue')), '0128,0,0128'); is(join(',',color_blend_bw ('red')), '0255,0128,0128'); is(join(',',color_blend ('red')), '0128,0128,0128'); is(join(',',color_bw ('red')), '77,77,77'); is(join(',',color_contrast_bw ('red')), '0255,0255,0255'); is(join(',',color_contrast ('red')), '0,0255,0255'); is(join(',',color_dark ('red')), '0128,0,0'); is(join(',',color_gray ('red')), '77,77,77'); is(join(',',color_grey ('red')), '77,77,77'); is(join(',',color_invert ('red')), '0,0255,0255'); is(join(',',color_light ('red')), '0255,0128,0128'); Color-Calc-1.074/t/import_object.t000444000765000024 157512411507274 17140 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; require Color::Calc; SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 13 if $@; Color::Calc->import( 'OutputFormat' => 'object' ); is(lc color_get ('red')->as_RGBhex, 'ff0000'); is(lc color ('red')->as_RGBhex, 'ff0000'); is(lc color_mix ('red','blue')->as_RGBhex, '800080'); is(lc color_blend_bw ('red')->as_RGBhex, 'ff8080'); is(lc color_blend ('red')->as_RGBhex, '808080'); is(lc color_bw ('red')->as_RGBhex, '4d4d4d'); is(lc color_contrast_bw ('red')->as_RGBhex, 'ffffff'); is(lc color_contrast ('red')->as_RGBhex, '00ffff'); is(lc color_dark ('red')->as_RGBhex, '800000'); is(lc color_gray ('red')->as_RGBhex, '4d4d4d'); is(lc color_grey ('red')->as_RGBhex, '4d4d4d'); is(lc color_invert ('red')->as_RGBhex, '00ffff'); is(lc color_light ('red')->as_RGBhex, 'ff8080'); } Color-Calc-1.074/t/import_tuple.t000444000765000024 140112411507274 17007 0ustar00cfaerberstaff000000000000use Test::More tests => 14; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'tuple' ); is(join(',',color_get ('red')), '0255,0,0'); is(join(',',color ('red')), '0255,0,0'); is(join(',',color_mix ('red','blue')), '0128,0,0128'); is(join(',',color_blend_bw ('red')), '0255,0128,0128'); is(join(',',color_blend ('red')), '0128,0128,0128'); is(join(',',color_bw ('red')), '77,77,77'); is(join(',',color_contrast_bw ('red')), '0255,0255,0255'); is(join(',',color_contrast ('red')), '0,0255,0255'); is(join(',',color_dark ('red')), '0128,0,0'); is(join(',',color_gray ('red')), '77,77,77'); is(join(',',color_grey ('red')), '77,77,77'); is(join(',',color_invert ('red')), '0,0255,0255'); is(join(',',color_light ('red')), '0255,0128,0128'); Color-Calc-1.074/t/import_WWW.t000444000765000024 111212411507274 16341 0ustar00cfaerberstaff000000000000use Test::More tests => 15; use Test::NoWarnings; use Color::Calc::WWW; is(color_get ('F00'), 'red'); is(color_get ('green'), 'green'); is(color ('F00'), 'red'); is(color_mix ('red','blue'), 'purple'); is(color_blend_bw ('red'), '#ff8080'); is(color_blend ('red'), 'gray'); is(color_bw ('red'), '#4d4d4d'); is(color_contrast_bw ('red'), 'white'); is(color_contrast ('red'), 'aqua'); is(color_dark ('red'), 'maroon'); is(color_gray ('red'), '#4d4d4d'); is(color_grey ('red'), '#4d4d4d'); is(color_invert ('red'), 'aqua'); is(color_light ('red'), '#ff8080'); Color-Calc-1.074/t/input_import.t000444000765000024 72012411507274 17000 0ustar00cfaerberstaff000000000000use Test::More tests => 9; use Test::NoWarnings; use Color::Calc( 'OutputFormat' => 'hex' ); is(color_mix ('F00','00F'), '800080'); is(color_mix ('#F00','#00F'), '800080'); is(color_mix ('FF0000','0000FF'), '800080'); is(color_mix ('#FF0000','#0000FF'), '800080'); is(color_mix ([255,0,0],[0,0,255]), '800080'); is(color_mix ('0255',0,0,0,0,255), '800080'); is(color_mix (['0255',0,0],0,0,255), '800080'); is(color_mix ('0255',0,0,[0,0,255]), '800080'); Color-Calc-1.074/t/input_oo.t000444000765000024 74512411507274 16112 0ustar00cfaerberstaff000000000000use Test::More tests => 9; use Test::NoWarnings; use Color::Calc(); my $cc = Color::Calc->new( 'OutputFormat' => 'hex' ); is($cc->mix ('F00','00F'), '800080'); is($cc->mix ('#F00','#00F'), '800080'); is($cc->mix ('FF0000','0000FF'), '800080'); is($cc->mix ('#FF0000','#0000FF'), '800080'); is($cc->mix ([255,0,0],[0,0,255]), '800080'); is($cc->mix ('0255',0,0,0,0,255), '800080'); is($cc->mix (['0255',0,0],0,0,255), '800080'); is($cc->mix ('0255',0,0,[0,0,255]), '800080'); Color-Calc-1.074/t/object-orientated.t000444000765000024 467412411507274 17705 0ustar00cfaerberstaff000000000000use Test::More tests => 49; use Test::NoWarnings; use Color::Calc(); my $cc = Color::Calc->new( 'OutputFormat' => 'hex' ); is($cc->get ('red'), 'ff0000'); is($cc->mix ('red','blue'), '800080'); is($cc->blend_bw ('red'), 'ff8080'); is($cc->blend ('red'), '808080'); is($cc->bw ('red'), '4d4d4d'); is($cc->contrast_bw ('red'), 'ffffff'); is($cc->contrast ('red'), '00ffff'); is($cc->dark ('red'), '800000'); is($cc->gray ('red'), '4d4d4d'); is($cc->grey ('red'), '4d4d4d'); is($cc->invert ('red'), '00ffff'); is($cc->light ('red'), 'ff8080'); $cc = Color::Calc->new( 'OutputFormat' => 'html' ); is($cc->get ('F00'), 'red'); is($cc->mix ('red','blue'), 'purple'); is($cc->blend_bw ('red'), '#ff8080'); is($cc->blend ('red'), 'gray'); is($cc->bw ('red'), '#4d4d4d'); is($cc->contrast_bw ('red'), 'white'); is($cc->contrast ('red'), 'aqua'); is($cc->dark ('red'), 'maroon'); is($cc->gray ('red'), '#4d4d4d'); is($cc->grey ('red'), '#4d4d4d'); is($cc->invert ('red'), 'aqua'); is($cc->light ('red'), '#ff8080'); SKIP: { eval { require Graphics::ColorObject; }; skip "Graphics::ColorObject not installed", 12 if $@; $cc = Color::Calc->new( 'OutputFormat' => 'object' ); is(lc $cc->get ('red')->as_RGBhex, 'ff0000'); is(lc $cc->mix ('red','blue')->as_RGBhex, '800080'); is(lc $cc->blend_bw ('red')->as_RGBhex, 'ff8080'); is(lc $cc->blend ('red')->as_RGBhex, '808080'); is(lc $cc->bw ('red')->as_RGBhex, '4d4d4d'); is(lc $cc->contrast_bw ('red')->as_RGBhex, 'ffffff'); is(lc $cc->contrast ('red')->as_RGBhex, '00ffff'); is(lc $cc->dark ('red')->as_RGBhex, '800000'); is(lc $cc->gray ('red')->as_RGBhex, '4d4d4d'); is(lc $cc->grey ('red')->as_RGBhex, '4d4d4d'); is(lc $cc->invert ('red')->as_RGBhex, '00ffff'); is(lc $cc->light ('red')->as_RGBhex, 'ff8080'); } $cc = Color::Calc->new( 'OutputFormat' => 'tuple' ); is(join(',',$cc->get ('red')), '0255,0,0'); is(join(',',$cc->mix ('red','blue')), '0128,0,0128'); is(join(',',$cc->blend_bw ('red')), '0255,0128,0128'); is(join(',',$cc->blend ('red')), '0128,0128,0128'); is(join(',',$cc->bw ('red')), '77,77,77'); is(join(',',$cc->contrast_bw ('red')), '0255,0255,0255'); is(join(',',$cc->contrast ('red')), '0,0255,0255'); is(join(',',$cc->dark ('red')), '0128,0,0'); is(join(',',$cc->gray ('red')), '77,77,77'); is(join(',',$cc->grey ('red')), '77,77,77'); is(join(',',$cc->invert ('red')), '0,0255,0255'); is(join(',',$cc->light ('red')), '0255,0128,0128'); Color-Calc-1.074/t/schemes_import_HTML.t000444000765000024 23012411507274 20110 0ustar00cfaerberstaff000000000000use Test::More tests => 2; use Test::NoWarnings; use Color::Calc('ColorScheme' => 'HTML', 'OutputFormat' => 'html'); is(color_get ('green'), 'green'); Color-Calc-1.074/t/schemes_import_X.t000444000765000024 17712411507274 17565 0ustar00cfaerberstaff000000000000use Test::More tests => 2; use Test::NoWarnings; use Color::Calc('OutputFormat' => 'html' ); is(color_get ('green'), 'lime'); Color-Calc-1.074/t/schemes_oo.t000444000765000024 57012411507274 16376 0ustar00cfaerberstaff000000000000use Test::More tests => 4; # use Test::NoWarnings; use Color::Calc(); my $cc; $cc = Color::Calc->new( 'OutputFormat' => 'html' ); isa_ok($cc, 'Color::Calc'); is($cc->get('green'), 'lime', 'X (default) ColorScheme'); $cc = Color::Calc->new( 'ColorScheme' => 'HTML', 'OutputFormat' => 'html' ); isa_ok($cc, 'Color::Calc'); is($cc->get('green'), 'green', 'HTML ColorScheme');