1LaTeXML::Common::Color(U3s)er Contributed Perl DocumentatLiaoTneXML::Common::Color(3)
2
3
4
6 "LaTeXML::Common::Color" - abstract class representating colors using
7 various color models; extends LaTeXML::Common::Object.
8
9 Exported functions
10 "$color = Color($model,@components);"
11 Creates a Color object using the given color model, and with the
12 given components. The core color models are "rgb", "hsv", "cmy",
13 "cmyk" and "gray". The components of colors using core color
14 models are between 0 and 1 (inclusive)
15
16 "Black", "White"
17 Constant color objects representing black and white, respectively.
18
19 Methods
20 "$model = $color->model;"
21 Return the name of the color model.
22
23 "@components = $color->components;"
24 Return the components of the color.
25
26 "$other = $color->convert($tomodel);"
27 Converts the color to another color model.
28
29 "$string = $color->toString;"
30 Returns a printed representation of the color.
31
32 "$hex = $color->toHex;"
33 Returns a string representing the color as RGB in hexadecimal (6
34 digits).
35
36 "$other = $color->toCore();"
37 Converts the color to one of the core colors.
38
39 "$complement = $color->complement();"
40 Returns the complement color (works for colors in "rgb", "cmy" and
41 "gray" color models).
42
43 "$new = $color->mix($other,$fraction);"
44 Returns a new color which results from mixing a $fraction of $color
45 with "(1-$fraction)" of color $other.
46
47 "$new = $color->add($other);"
48 Returns a new color made by adding the components of the two
49 colors.
50
51 "$new = $color->scale($m);"
52 Returns a new color made by mulitiplying the components by $n.
53
54 "$new = $color->multiply(@m);"
55 Returns a new color made by mulitiplying the components by the
56 corresponding component from @n.
57
59 Supported color models: LaTeXML::Common::Color::rgb,
60 LaTeXML::Common::Color::hsb, LaTeXML::Common::Color::cmy,
61 LaTeXML::Common::Color::cmyk, LaTeXML::Common::Color::gray and
62 LaTeXML::Common::Color::Derived.
63
65 Bruce Miller <bruce.miller@nist.gov>
66
68 Public domain software, produced as part of work done by the United
69 States Government & not subject to copyright in the US.
70
71
72
73perl v5.38.0 2023-07-19 LaTeXML::Common::Color(3)