ColorTools - Maple Help

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

ColorTools

 HexToRGB24
 convert hex string to RGB value

 Calling Sequence HexToRGB24(hex)

Parameters

 hex - string; hex code for color, can be a 12-bit or 24-bit hex code with or without a leading "#": "#rrggbb", "rrggbb", "#rgb", or "rgb"

Description

 • The HexToRGB24 procedure converts from a hex code to the RGB values. If the input is not a valid hex color value, an error occurs.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{HexToRGB24}\left("#00FF00"\right)$
 $\left[{0}{,}{255}{,}{0}\right]$ (1)
 > $\mathrm{HexToRGB24}\left("FF0000"\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (2)
 > $\mathrm{HexToRGB24}\left("F00"\right)$
 $\left[{255}{,}{0}{,}{0}\right]$ (3)
 > $\mathrm{HexToRGB24}\left("I like cat videos"\right)$

Compatibility

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