LaTeXML::Common::Color - abstract class representating colors using various color models; extends LaTeXML::Common::Object.
LaTeXML::Common::Color
$color = Color($model,@components);
Creates a Color object using the given color model, and with the given components. The core color models are rgb, hsv, cmy, cmyk and gray. The components of colors using core color models are between 0 and 1 (inclusive)
rgb
hsv
cmy
cmyk
gray
Black
White
Constant color objects representing black and white, respectively.
$model = $color->model;
Return the name of the color model.
@components = $color->components;
Return the components of the color.
$other = $color->convert($tomodel);
Converts the color to another color model.
$string = $color->toString;
Returns a printed representation of the color.
$hex = $color->toHex;
Returns a string representing the color as RGB in hexadecimal (6 digits).
$other = $color->toCore();
Converts the color to one of the core colors.
$complement = $color->complement();
Returns the complement color (works for colors in rgb, cmy and gray color models).
$new = $color->mix($other,$fraction);
Returns a new color which results from mixing a $fraction of $color with (1-$fraction) of color $other.
$fraction
$color
(1-$fraction)
$other
$new = $color->add($other);
Returns a new color made by adding the components of the two colors.
$new = $color->scale($m);
Returns a new color made by mulitiplying the components by $n.
$n
$new = $color->multiply(@m);
Returns a new color made by mulitiplying the components by the corresponding component from @n.
@n
Supported color models: LaTeXML::Common::Color::rgb, LaTeXML::Common::Color::hsb, LaTeXML::Common::Color::cmy, LaTeXML::Common::Color::cmyk, LaTeXML::Common::Color::gray and LaTeXML::Common::Color::Derived.
Bruce Miller <bruce.miller@nist.gov>
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.
To install LaTeXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LaTeXML
CPAN shell
perl -MCPAN -e shell install LaTeXML
For more information on module installation, please visit the detailed CPAN module installation guide.