Lookup - Maple Help

ColorTools[Palette]

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

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.290196078431373,0.52156862745098,0.831372549019608}{RGB : 0.29 0.522 0.83}{⟩}$ (4)
 > $\mathrm{Lookup}\left(P,"Cobalt",\mathrm{shade}="point"\right)$
 ${⟨}\colorbox[rgb]{0.0823529411764706,0.431372549019608,0.623529411764706}{{RGB : 0.0814 0.431 0.623}}{⟩}$ (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]{1,0.517647058823529,0.588235294117647}{RGB : 1 0.516 0.589}{⟩}$ (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.