ColorTools[Palette]
Lookup
look up a color in a Palette object by name or index
Calling Sequence
Parameters
Description
Examples
Compatibility
Lookup(P,color)
Lookup(P,color,fast,shade=type)
P
-
Palette object created with ColorTools:-Palette
color
string or a positive integer
fast
(optional) keyword option
shade
(optional) keyword option of the form shade=type, where type can be one of fill, line, or point
The Lookup command looks up color in P.
The argument color can be a string that is the name of a color in P or a positive integer index.
If fast is given, P will not be expanded automatically when a numeric index is given beyond the current size of the palette.
The shade option controls the automatic transformation of colors of P for use with different plot objects. For example, if you make a plot with a point, a line, and a filled region and want their colors to look similar on a white background, you could use the colors returned by Lookup(P,1,shade="point"), Lookup(P,1,shade="line"), and Lookup(P,1,shade="fill") respectively.
The fast and shade options do not apply to palette of type dictionary.
P≔ColorTools:-GetPalette⁡spring
P≔Palette Spring:⁢Blue⁢Rose⁢YellowGreen⁢BlueGreen⁢Violet⁢Cobalt⁢Yellow⁢PurpleRed⁢GreenBlue⁢PaleGreen⁢Orange⁢Purple⁢Green⁢SeaBlue⁢PaleYellow⁢PaleBlueGreen
Lookup⁡P,1
〈RGB : Blue〉
Lookup⁡P,Purple
〈RGB : Purple〉
Lookup⁡P,1,shade=fill
〈RGB : 0.217 0.558 0.898〉
Lookup⁡P,Cobalt,shade=point
〈RGB : 0.236 0.443 0.6〉
Lookup⁡P,10
〈RGB : Pale Green〉
Lookup⁡P,numcolors⁡P+1
〈RGB : 0 0 0〉
An error will be thrown if fast is specified and color is an integer larger than the number of original colors in the palette
Lookup⁡P,numcolors⁡P+100,fast
Error, (in ColorTools:-Palette:-Lookup) invalid color 116 is not defined in this palette
An error will also be thrown if color is a string and not the name of a color in the palette.
Lookup⁡P,Blurple
Error, (in ColorTools:-Palette:-Lookup) invalid color Blurple is not defined in this palette
The ColorTools[Palette][Lookup] command was introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
See Also
Download Help Document