NAME

Color::Model::Munsell - Color model of Munsell color system

SYNOPSIS

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;

Nuetral grays;

$mun = Color::Model::Munsell->new("N 4.5");
$mun = Color::Model::Munsell->new("N", 9);
print "$mum is nuetral color" if $mun->isneutral;

CONSTRUCTOR

# 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 color 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 has a reason of the error.

CONSTANTS

There are some constants which make an object of black or white, using tag ":vertexes" or ":all".

PUREWHITE();        # return an object of "N 10.0"
PUREBLACK();        # return an object of "N 0.0"
REALWHITE();        # return an object of "N 9.5"
REALBLACK();        # return an object of "N 1.0"

METHODS

$m->code();         # Munsell code like "5R 9.5/14"
$m->ischromatic();  # boolean color is chromatic or not
$m->isneutral();    # boolean color is nuegray or not
$m->hue();          # hue
$m->hueCol();       # color name of hue; R,YR,Y,GY,G,BG,B,PB,P,RP or N
$m->hueStep();      # number part of hue (gray returns undef)
$m->value();        # value
$m->lightness();    # same as value
$mun->chroma();     # chroma (gray returns undef)
$mun->saturation(); # same as chroma
$m->degree();       # see degree()

isblack(), iswhite();

$m->isblack();      # return 1 if value is equal or lesser than 1.0, or 0
$m->iswhite();      # return 1 if value is equal or greater than 9.5, or 0

Note that these returns a result whether object is chromatic.

FUNCTIONS

degree($huecode), $m->degree();

Function degree() return a serial hue number from hue code of chromatic color, considering 10.0RP is 0, 10R to be 10, 10YR 20, ..., and ends 9.9RP as 99.9. This will be useful to get radians of Muncell color circle.

undegree($degreenum);

Function undegree() return a hue code from a serial hue number which is from 0.0 to 100.0.

OPERATOR OVERLOAD

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"

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Color::Model::Munsell

You can also look for information at:

AUTHOR

Takahiro Onodera, <ong at garakuta.net>

LICENSE AND COPYRIGHT

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.