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

ColorTools[Palette]

 Lookup
 look up a color in a Palette object by name or index

 Calling Sequence Lookup(P,color) Lookup(P,color,fast,shade=type)

Parameters

 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

Description

 • 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.

Examples

 > $P≔\mathrm{ColorTools}:-\mathrm{GetPalette}\left("spring"\right)$
 ${P}{≔}⟨{Palette Spring:}{}\colorbox[rgb]{0,0.454901960784314,0.8}{{Blue}}{}\colorbox[rgb]{0.8,0,0.454901960784314}{{Rose}}{}\colorbox[rgb]{0.454901960784314,0.8,0}{YellowGreen}{}\colorbox[rgb]{0,0.8,0.745098039215686}{BlueGreen}{}\colorbox[rgb]{0.345098039215686,0,0.8}{{Violet}}{}\colorbox[rgb]{0.294117647058824,0.494117647058824,0.650980392156863}{Cobalt}{}\colorbox[rgb]{0.756862745098039,0.8,0}{Yellow}{}\colorbox[rgb]{0.8,0,0.305882352941176}{{PurpleRed}}{}\colorbox[rgb]{0,0.254901960784314,0.8}{{GreenBlue}}{}\colorbox[rgb]{0.294117647058824,0.650980392156863,0.450980392156863}{PaleGreen}{}\colorbox[rgb]{0.8,0.494117647058824,0}{Orange}{}\colorbox[rgb]{0.745098039215686,0,0.8}{{Purple}}{}\colorbox[rgb]{0,0.8,0.2}{Green}{}\colorbox[rgb]{0,0.654901960784314,0.8}{SeaBlue}{}\colorbox[rgb]{0.607843137254902,0.650980392156863,0.294117647058824}{PaleYellow}{}\colorbox[rgb]{0.294117647058824,0.650980392156863,0.650980392156863}{PaleBlueGreen}⟩$ (1)
 > $\mathrm{Lookup}\left(P,1\right)$
 ${⟨}\colorbox[rgb]{0,0.454901960784314,0.8}{{RGB : Blue}}{⟩}$ (2)
 > $\mathrm{Lookup}\left(P,"Purple"\right)$
 ${⟨}\colorbox[rgb]{0.745098039215686,0,0.8}{{RGB : Purple}}{⟩}$ (3)
 > $\mathrm{Lookup}\left(P,1,\mathrm{shade}="fill"\right)$
 ${⟨}\colorbox[rgb]{0.215686274509804,0.556862745098039,0.898039215686275}{RGB : 0.217 0.558 0.898}{⟩}$ (4)
 > $\mathrm{Lookup}\left(P,"Cobalt",\mathrm{shade}="point"\right)$
 ${⟨}\colorbox[rgb]{0.235294117647059,0.443137254901961,0.6}{{RGB : 0.236 0.443 0.6}}{⟩}$ (5)
 > $\mathrm{Lookup}\left(P,10\right)$
 ${⟨}\colorbox[rgb]{0.294117647058824,0.650980392156863,0.450980392156863}{RGB : Pale Green}{⟩}$ (6)
 > $\mathrm{Lookup}\left(P,\mathrm{numcolors}\left(P\right)+1\right)$
 ${⟨}\colorbox[rgb]{0,0,0}{{RGB : 0 0 0}}{⟩}$ (7)

An error will be thrown if fast is specified and color is an integer larger than the number of original colors in the palette

 > $\mathrm{Lookup}\left(P,\mathrm{numcolors}\left(P\right)+100,\mathrm{fast}\right)$

An error will also be thrown if color is a string and not the name of a color in the palette.

 > $\mathrm{Lookup}\left(P,"Blurple"\right)$

Compatibility

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