HexToString - Maple Help

ColorTools

 HexToString
 look up color name by hex string

 Calling Sequence HexToString(hex)

Parameters

 hex - :string: : hex code for color, can be "#rrggbb" or "rrggbb"

Options

 • new : boolean; indicates whether to restrict to new color names (true), old color names (false), or no restriction (the default)
 • default : string; default value to return when there is no match

Description

 • The HexToString procedure converts from a hex color value to a translated color name (based upon the current locale in the Maplets context).
 • The new option acts as follows:

new=true: only search new color names

new=false: only search old color names

default (option new not specified): search both new and old color names

 • If a default value is provided, then that is returned when no match is found, otherwise an error occurs.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{HexToString}\left("#00FF00"\right)$
 ${"Lime"}$ (1)
 > $\mathrm{HexToString}\left("#0F0",\mathrm{new}=\mathrm{false}\right)$
 ${"green"}$ (2)
 > $\mathrm{HexToString}\left("FF0000"\right)$
 ${"Red"}$ (3)
 > $\mathrm{HexToString}\left("F00"\right)$
 ${"Red"}$ (4)
 > $\mathrm{HexToString}\left("I like cat videos"\right)$

Compatibility

 • The ColorTools[HexToString] command was introduced in Maple 16.