NAME

LaTeXML::Common::Color - abstract class representating colors using various color models; extends LaTeXML::Common::Object.

Exported functions

$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)

Black, White

Constant color objects representing black and white, respectively.

Methods

$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.

$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.

$new = $color->multiply(@m);

Returns a new color made by mulitiplying the components by the corresponding component from @n.

SEE ALSO

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.

AUTHOR

Bruce Miller <bruce.miller@nist.gov>

COPYRIGHT

Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.