find the closest color with a name - Maple Help

Home : Support : Online Help : Graphics : Packages : ColorTools : ColorTools/NearestNamedColor

ColorTools/NearestNamedColor - find the closest color with a name

 Calling Sequence NearestNamedColor(color)

Parameters

 color - color format recognized by ColorTools

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.005383533871}\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.005821707864}\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.005821707864}\right]{,}\left[{"CSS Maroon"}{,}{0.3049415220}\right]{,}\left[{"CSS Orange"}{,}{0.3206349323}\right]\right]$ (4)
 > $\mathrm{NearestNamedColor}\left("#cab",\mathrm{number}=3,\mathrm{palette}="all"\right)$
 $\left[\left[{"Resene Lily"}{,}{0.02195250833}\right]{,}\left[{"Generic LightGrayishPurpleRed"}{,}{0.03933517740}\right]{,}\left[{"Generic LightGrayishRedPurple"}{,}{0.04052141343}\right]\right]$ (5)