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

Online Help

All Products    Maple    MapleSim


ColorTools[Palette]

  

Lookup

  

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

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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≔ColorTools:-GetPalette⁡spring

P≔Palette Spring:⁢Blue⁢Rose⁢YellowGreen⁢BlueGreen⁢Violet⁢Cobalt⁢Yellow⁢PurpleRed⁢GreenBlue⁢PaleGreen⁢Orange⁢Purple⁢Green⁢SeaBlue⁢PaleYellow⁢PaleBlueGreen

(1)
> 

Lookup⁡P,1

⟨RGB : Blue⟩

(2)
> 

Lookup⁡P,Purple

⟨RGB : Purple⟩

(3)
> 

Lookup⁡P,1,shade=fill

⟨RGB : 0.217 0.558 0.898⟩

(4)
> 

Lookup⁡P,Cobalt,shade=point

⟨RGB : 0.236 0.443 0.6⟩

(5)
> 

Lookup⁡P,10

⟨RGB : Pale Green⟩

(6)
> 

Lookup⁡P,numcolors⁡P+1

⟨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

> 

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

Compatibility

• 

The ColorTools[Palette][Lookup] command was introduced in Maple 16.

• 

For more information on Maple 16 changes, see Updates in Maple 16.

See Also

ColorTools[Palette]