Skip Menu |

This queue is for tickets about the Color-Calc CPAN distribution.

Report information
The Basics
Id: 8049
Status: resolved
Priority: 0/
Queue: Color-Calc

People
Owner: CFAERBER [...] cpan.org
Requestors: evilio [...] vodafone.es
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.20
Fixed in: 0.29_0001



Subject: Improper translation of names
Your module works fine but I think that there should be way to force the map used for name conversions. For example if I want to work with HTML names only I would like to have something like this: use Color::Calc; my $color = Color::Calc::color_html('green'); my $backgound = Color::Calc::color_html('lime'); both commands does not behave as expected. The "green" name in HTML is #008000 (not #00ff00), and the "lime" color is #00ff00 but I've got the message "Unknown color 'lime' at...". So I think that one could use some kind of option in Color::Calc to specify which names are accepted for input. For example: use Color::Calc qw( :html ); # Use HTML input color names use Color::Calc qw( :X ); # Use X11 input color names (default?) use Color::Calc qw( :MyColorScheme) # Use # Graphics::ColorNames::MyColorScheme
*** Color-Calc-0.20/Calc.pm 2004-03-29 02:10:08.000000000 +0200 --- Color-Calc-0.21/Calc.pm 2004-10-19 13:50:15.080682913 +0200 *************** *** 9,11 **** ! our $VERSION = '0.20'; $VERSION = eval $VERSION; --- 9,11 ---- ! our $VERSION = '0.21'; $VERSION = eval $VERSION; *************** *** 29,31 **** my %ColorNames = (); ! tie %ColorNames, 'Graphics::ColorNames'; --- 29,31 ---- my %ColorNames = (); ! tie %ColorNames, 'Graphics::ColorNames', 'HTML';
Subject: Improper translation of names
Your module works fine but I think that there should be way to force the map used for color name conversions. For example if I want to work with HTML names only I would like to have something like this: use Color::Calc; my $color = Color::Calc::color_html('green'); my $backgound = Color::Calc::color_html('lime'); both commands does not behave as expected. The "green" name in HTML is #008000 (not #00ff00), and the "lime" color is #00ff00 but I've got the message "Unknown color 'lime' at...". So I think that one could use some kind of option in Color::Calc to specify which names are accepted for input. For example: use Color::Calc qw( :html ); # Use HTML input color names use Color::Calc qw( :X ); # Use X11 input color names (default?) use Color::Calc qw( :MyColorScheme) # Use # Graphics::ColorNames::MyColorScheme # for color names I send you a patch to suggest where this can be done. I have changed line 30 so now reads: tie %ColorNames, 'Graphics::ColorNames', 'HTML'; so that the HTML color scheme is loaded in Color::Calc. A more consistent way to implement this is that each color_* function would accept the proper scheme so tou can have: use Color::Calc; my $x_green = Color::Calc::color_x('green'); # This is #00ff00 my $h_green = Color::Calc::color_html('green'); # This is #00e000 ...etc TIA, Evili
*** Color-Calc-0.20/Calc.pm 2004-03-29 02:10:08.000000000 +0200 --- Color-Calc-0.21/Calc.pm 2004-10-19 13:50:15.080682913 +0200 *************** *** 9,11 **** ! our $VERSION = '0.20'; $VERSION = eval $VERSION; --- 9,11 ---- ! our $VERSION = '0.21'; $VERSION = eval $VERSION; *************** *** 29,31 **** my %ColorNames = (); ! tie %ColorNames, 'Graphics::ColorNames'; --- 29,31 ---- my %ColorNames = (); ! tie %ColorNames, 'Graphics::ColorNames', 'HTML';