Color - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

ColorTools

 Color
 construct a color data structure

 Calling Sequence Color(colorspace, coordinates) Color(colorspace, color) Color(color)

Parameters

 colorspace - string designating a known color space; "RGB" by default coordinates - coordinates of the color in the given color space color - color format recognized by ColorTools

Description

 • The Color procedure is a constructor for a color data structure.  This data structure is recognized by most ColorTools commands and many plot commands.
 • The parameter colorspace can be any of the color spaces listed on the ColorTools/ColorSpaces help page.
 • Color structures can be indexed as lists.  Two structures are considered equal only if their distance (in the CIE76 metric) is less than ${10}^{-\frac{\mathrm{Digits}}{2}}$.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$

Colors can be constructed with names

 > $\mathrm{Color}\left("Niagara 1"\right)$
 ${⟨}\colorbox[rgb]{0.470588235294118,0,0.0549019607843137}{{RGB : 0.471 0 0.0549}}{⟩}$ (1)
 > $\mathrm{Color}\left("HSV","Niagara 1"\right)$
 ${⟨}\colorbox[rgb]{0.470588235294118,0,0.0549019607843137}{{HSV : 0.981 1 0.471}}{⟩}$ (2)

or with coordinates in the specified space

 > $\mathrm{Color}\left(\left[0.5,0.6,0.6\right]\right)$
 ${⟨}\colorbox[rgb]{0.501960784313725,0.6,0.6}{RGB : 0.5 0.6 0.6}{⟩}$ (3)
 > $\mathrm{Color}\left("HSV",\left[0.5,0.6,0.6\right]\right)$
 ${⟨}\colorbox[rgb]{0.23921568627451,0.6,0.6}{HSV : 0.5 0.6 0.6}{⟩}$ (4)
 > $\mathrm{Color}\left("XYZ",\left[0.5,0.6,0.6\right]\right)$
 ${⟨}\colorbox[rgb]{0.662745098039216,0.835294117647059,0.76078431372549}{XYZ : 0.5 0.6 0.6}{⟩}$ (5)

They can be indexed as lists using either numeric or character indices

 > $G≔\mathrm{Color}\left("Green"\right)$
 ${G}{≔}{⟨}\colorbox[rgb]{0,0.501960784313725,0}{{RGB : 0 0.502 0}}{⟩}$ (6)
 > ${G}_{2}$
 ${0.50196078}$ (7)
 > ${G}_{"G"}$
 ${0.50196078}$ (8)
 > ${G}_{[]}$
 ${0.}{,}{0.50196078}{,}{0.}$ (9)
 > $\mathrm{G2}≔\mathrm{Color}\left("Lab",G\right)$
 ${\mathrm{G2}}{≔}{⟨}\colorbox[rgb]{0,0.501960784313725,0}{{Lab : 46.2 -51.7 49.9}}{⟩}$ (10)
 > ${\mathrm{G2}}_{"a"}$
 ${-51.6992788122122}$ (11)

Two colors can be the same even if they are specified in difference color spaces

 > $\mathrm{evalb}\left(G=\mathrm{G2}\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{Distance}\left(G,\mathrm{G2},\mathrm{metric}='\mathrm{cie76}'\right)$
 ${0.}$ (13)
 > $\mathrm{evalb}\left(G=\mathrm{Darken}\left(G\right)\right)$
 ${\mathrm{false}}$ (14)
 > $\mathrm{Distance}\left(G,\mathrm{Darken}\left(\mathrm{G2}\right),\mathrm{metric}='\mathrm{cie76}'\right)$
 ${0.139737281656224}$ (15)

Compatibility

 • The ColorTools[Color] command was introduced in Maple 16.
 • For more information on Maple 16 changes, see Updates in Maple 16.

 See Also