NearestNamedColor - Maple Help

ColorTools/NearestNamedColor

find the closest color with a name

 Calling Sequence NearestNamedColor(color)

Parameters

 color - color format recognized by ColorTools

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

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{NearestNamedColor}\left(\left[255,16,0\right]\right)$
 $\left[{"Red"}{,}{0.005383533765}\right]$ (1)
 > $\mathrm{NearestNamedColor}\left(\left[255,16,0\right],\mathrm{metric}="RGB"\right)$
 $\left[{"Red"}{,}{0.03622589921}\right]$ (2)
 > $\mathrm{NearestNamedColor}\left("#f10",\mathrm{new}=\mathrm{false}\right)$
 $\left[{"red"}{,}{0.005821704028}\right]$ (3)
 > $\mathrm{NearestNamedColor}\left("#f10",\mathrm{number}=3,\mathrm{palette}=\left["css",\mathrm{GetPalette}\left("niagara"\right)\right]\right)$
 $\left[\left[{"CSS Red"}{,}{0.005821704028}\right]{,}\left[{"CSS Maroon"}{,}{0.3049415200}\right]{,}\left[{"CSS Orange"}{,}{0.3206349366}\right]\right]$ (4)
 > $\mathrm{NearestNamedColor}\left("#cab",\mathrm{number}=3,\mathrm{palette}="all"\right)$
 $\left[\left[{"Resene Lily"}{,}{0.02195202151}\right]{,}\left[{"Generic LightGrayishPurpleRed"}{,}{0.03933571282}\right]{,}\left[{"Generic LightGrayishRedPurple"}{,}{0.04052144630}\right]\right]$ (5)

Compatibility

 • The ColorTools/NearestNamedColor command was introduced in Maple 16.
 • For more information on Maple 16 changes, see Updates in Maple 16.