convert/color
convert a color to a different format
Calling Sequence
Parameters
Description
Examples
Compatibility
convert( incolor, 'color')
convert( incolor, 'color', format)
convert( incolor, 'color', outspace)
convert( incolor, 'color', format, outspace)
convert( incolor, 'color', inspace, format)
incolor
-
any color format recognized by the ColorTools package
format
string or name specifying the output format, valid choices listed in below
outspace
string specifying a color space use when format is object or list, defaults to "RGB"
inspace
string specifying an input color space when incolor is a list of numbers, defaults to "RGB"
This conversion is a flexible wrapper to ColorTools:-Convert and the other various conversions in the ColorTools package.
Valid values for format are
"list", a list of coordinates, the default if incolor is not an object or outspace is RGB24
"object", a ColorTools:-Color object, the default if incolor is an object and outspace is not RGB24
"hex", a hexadecimal representation of the color as a string using ColorTools:-RGB24ToHex
"colorname", a string that is the name of a color known by ColorTools using ColorTools:-RGB24ToName first with no options, then with palette=all if that fails
"plotcolor", a data structure used internally by plots, (previously undocumented as the colorRGB conversion) using ColorTools:-ToPlotColor
convertRed,color
1.00000000,0.,0.
convertBlue,color,hex
#0000FF
convertGreen,color,RGB24
0,128,0
convert#008000,color,colorname
Green
convertNiagara 2,color,colorname
Niagara Navy
convertBlack,color,plotcolor
COLORRGB,0.,0.,0.
If the second argument is a color space, a list of coordinates is the default, unless the color is an object
convertWhite,color,XYZ
0.950471667112831,0.999957033132343,1.08897820520418
convertColorTools:-ColorWhite,color,XYZ
⟨XYZ : 0.95 1 1.09⟩
convertWhite,color,RGB24
255,255,255
"RGB24" is not a color space supported by color objects, so is always returned as a list of integers
convertColorTools:-ColorRed,color,RGB24
255,0,0
convert1.00000000,0.,0.,color,RGB24
If the input is a list of numbers, it's assumed to be RGB unless an input color space is also specified
convert1,1,1,color,XYZ
convert1,1,1,color,RGB24,XYZ
0.000288493798020974,0.000303513941896270,0.000330534269722868
convert raises an error if an input color space is given for anything other than a list of numbers
convert#cab,color,RGB24,colorname
Error, (in `convert/color`) invalid input: an input colorspace can only be specified when the input is given as a list of coordinates
convertColorTools:-ColorNiagara 4,color,RGB24,hex
The convert/color command was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
convert
Download Help Document