ColorTools[Palette]
ReverseLookup
look up a color in a Palette object by name or index
Calling Sequence
Parameters
Description
Examples
Compatibility
ReverseLookup(P,color)
ReverseLookup(P,color,fast)
P
-
Palette object created with ColorTools:-Palette
color
a color in any format understood by ColorTools
fast
(optional) keyword option
The ReverseLookup command finds if a color is part of palette P and if so, returns its positive integer index in P.
If color is not a member of P and error will occur.
If fast is specified, the colors generated when P is expanded automatically will not be checked during the reverse lookup.
P≔ColorTools:-GetPalette⁡spring
P≔Palette Spring:⁢Blue⁢Rose⁢YellowGreen⁢BlueGreen⁢Violet⁢Cobalt⁢Yellow⁢PurpleRed⁢GreenBlue⁢PaleGreen⁢Orange⁢Purple⁢Green⁢SeaBlue⁢PaleYellow⁢PaleBlueGreen
ReverseLookup⁡P,P1
Blue
Using the fast option with ReverseLookup will not check for colors generated by automatic palette expansion.
Lookup⁡P,numcolors⁡P+1
〈RGB : 0 0 0〉
ReverseLookup⁡P,Lookup⁡P,numcolors⁡P+1,fast
Error, (in ColorTools:-Palette:-ReverseLookup) invalid color ColorTools:-Color("RGB",[0., 0., 0.]) is not in the palette
The ColorTools[Palette][ReverseLookup] command was introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
See Also
Download Help Document