ColorTools[Palette]
KnownColor
check if a string is a valid color name in a palette
Calling Sequence
Parameters
Description
Examples
Compatibility
KnownColor(P,color)
P
-
Palette object created with ColorTools:-Palette
color
string or a positive integer
The KnownColor command returns true if color is the name of a color in the palette P. It is useful for avoiding the errors thrown by the Lookup command for colors not in a palette.
P≔ColorTools:-GetPalette⁡CSS
P≔Palette CSS:⁢Black⁢Red⁢Maroon⁢Orange⁢Yellow⁢Olive⁢Lime⁢Green⁢Aqua⁢Teal⁢Blue⁢Navy⁢Fuchsia⁢Purple⁢Gray⁢Silver⁢White
KnownColor⁡P,Grey
true
KnownColor⁡P,Gray
KnownColor⁡P,Griy
false
An error will be thrown if a color is not in a palette
Lookup⁡P,Griy
Error, (in ColorTools:-Palette:-Lookup) invalid color Griy is not defined in this palette
The ColorTools[Palette][KnownColor] command was introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
See Also
ColorTools[Palette][Lookup]
Download Help Document