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

Online Help

All Products    Maple    MapleSim


ColorTools

  

NearestNamedColor

  

find the closest color with a name

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

NearestNamedColor(color, opts)

Parameters

color

-

color format recognized by ColorTools

opts

-

(optional) equation(s) of the form option=value where option is one of metric, new, number, palette, or threshold

Options

• 

metric=string or name : the type of color distance to use

• 

new = truefalse : option passed to GetColorNames if palette is not specified

• 

number =  posint : the maximum number of nearby colors to return

• 

palette : a palette or palette name, a list of palettes and/or palette names, or "all"

• 

threshold = float : a maximum distance.  If number is not specified all results closer than this value will be returned.

Description

• 

The NearestNamedColor command locates one or more of the nearest named colors to the input color.

• 

It returns one or more named colors, along with the distances from the input color. When there is only one result, that single nearest color name is output, along with the distance in the specified metric (cie94 by default).

• 

When the number of outputs is greater than one, then the output is a list of the nearest colors and distances, closest first.

Examples

withColorTools:

NearestNamedColor255,16,0

Red,0.00538421830630291

(1)

NearestNamedColor255,16,0,metric=RGB

Red,0.03622589921

(2)

NearestNamedColor#f10,new=false

red,0.00582244455010256

(3)

NearestNamedColor#f10,number=3,palette=css,GetPaletteniagara

CSS Red,0.00582244455010256,CSS Maroon,0.304924827107045,CSS Orange,0.320683392648266

(4)

NearestNamedColor#cab,number=3,palette=all

Resene Lily,0.0219490766547210,Generic LightGrayishPurpleRed,0.0393340868515053,Generic LightGrayishRedPurple,0.0405215490441851

(5)

Compatibility

• 

The ColorTools:-NearestNamedColor command was introduced in Maple 16.

• 

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

See Also

ColorTools

ColorTools/ColorSpaces

ColorTools:-Color

ColorTools:-Distance