Color::Model::Munsell - Color model of Munsell color system
Chromatic color;
$mun = Color::Model::Munsell->new("9R 5.5/14"); $mun = Color::Model::Munsell->new("7PB", 4, 10); print "$mum is chromatic color" if !$mun->isneutral;
Neutral grays;
$mun = Color::Model::Munsell->new("N 4.5"); $mun = Color::Model::Munsell->new("N", 9); print "$mum is neutral color" if $mun->isneutral;
# with Munsell color specifying $m = Color::Model::Munsell->new("9R 5.5/14"); $m = Color::Model::Munsell->new("N 4.5"); # with parapeters $m = Color::Model::Munsell->new("7PB", 4, 10); $m = Color::Model::Munsell->new("N", 9);
If number part of hue is 0, it becomes 10.0 of previous hue color on the circle.
Value(as Lightness) or chroma has thier range; 0 <= value <= 10.0 # if 0 or 10, it will be regraded as black or white 0 <= chroma # if 0, it will be gray
and these number will be rounded up to the tenth's place with sprintf().
If constructor returns undef, it means some error occurs. When this case, Check $Color::Model::Munsell::ERROR that have a reason of an error.
Munsell() is defalut exporting subroutine which calls new().
$m = Munsell("9R 5.5/14");
There are some constants which makes black or white object. Use tag ":vertexes" or ":all".
return an object of "N 10.0"
return an object of "N 0.0"
return an object of "N 9.5"
return an object of "N 1.0"
Object Color::Model::Munsell has methods below.
Color::Model::Munsell
Returns Munsell code like "5R 10/14" or "N 4.5".
Returns 1 if object is chromatic, or 0.
Returns 1 if object is neutral color, or 0.
Return 1 if value is equal or lesser than 1.0, or 0
Return 1 if value is equal or greater than 9.5, or 0
Returns hue code like "5R" or "N".
Returns color sign of hue; R,YR,Y,GY,G,BG,B,PB,P,RP or N
Returns number of hue (gray returns undef)
Returns Munsell value.
Same as value()
Returns Munsell chroma.
Same as chroma().
See degree() below.
print $m->degree(); print degree("7.5B");
Subroutine or object method degree() return a serial hue number, considering 10.0RP is 0, 10R is 10, 10YR is 20, ..., and ends 9.9RP as 99.9. This will be useful to get radians of Muncell color circle. If object is neutral, this returns undef.
degree()
print undegree();
Function undegree() return a hue code from a serial hue number.
Stringify operator of this module, Color::Model::Munsell, is prepared. If you join a object with some string, object will be Munsell code.
$m = Color::Model::Munsell->new("9R", 5.5, 14); print "$m is red"; # printing "9R 5.5/14 is red"
Please report any bugs or feature requests to bug-color-model-munsell at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Color-Model-Munsell. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-color-model-munsell at rt.cpan.org
Takahiro Onodera, <ong at garakuta.net>
<ong at garakuta.net>
Copyright 2010 T.Onodera.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Color::Model::Munsell, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Color::Model::Munsell
CPAN shell
perl -MCPAN -e shell install Color::Model::Munsell
For more information on module installation, please visit the detailed CPAN module installation guide.