KnownColor - 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]

  

KnownColor

  

check if a string is a valid color name in a palette

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

KnownColor(P,color)

Parameters

P

-

Palette object created with ColorTools:-Palette

color

-

string or a positive integer

Description

• 

The KnownColor command returns true if color is the name of a color in the palette P.  It is useful for avoiding the errors thrown by the Lookup command for colors not in a palette.

Examples

> 

P≔ColorTools:-GetPalette⁡CSS

P≔Palette CSS:⁢Black⁢Red⁢Maroon⁢Orange⁢Yellow⁢Olive⁢Lime⁢Green⁢Aqua⁢Teal⁢Blue⁢Navy⁢Fuchsia⁢Purple⁢Gray⁢Silver⁢White

(1)
> 

KnownColor⁡P,Grey

true

(2)
> 

KnownColor⁡P,Gray

true

(3)
> 

KnownColor⁡P,Griy

false

(4)

An error will be thrown if a color is not in a palette

> 

Lookup⁡P,Griy

Error, (in ColorTools:-Palette:-Lookup) invalid color Griy is not defined in this palette

Compatibility

• 

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

• 

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

See Also

ColorTools[Palette][Lookup]