ColorTools
ToDisplayable
compute a nearby color that can be represented in RGB
Calling Sequence
Parameters
Description
Examples
Compatibility
ToDisplayable(color, mopt)
color
-
color in a format recognized by ColorTools
mopt
(optional) equation of the form mode = string, indicating the method used to compute the resulting color
Many colors in the device independent colors spaces, such as CIE Lab, cannot be exactly represented in RGB and displayed on a monitor. The ToDisplayable command computes a nearby color that can be represented in RGB and thus displayed.
A color object that is not exactly displayable will be displayed with asterisks around the color space when the color object is printed.
By default a nearby color is determined by moving along the line towards the 50% gray in the CIE XYZ color space until a displayable color is reached. This can be specified explicitly by specifying the option mode = "XYZ".
Specifying mode = "Lab" will instead move along the line towards the neutral gray point in the CIE Lab color space that has the same L-coordinate as color.
Specifying mode = "HSV" will preserve the hue and truncate the saturation and value coordinates of color in the HSV color space to the range 0..1.
Specifying mode = "RGB" will truncate each of the coordinates of color in the RGB color space to the range 0..1.
Specifying mode = "RGBscale" will represent color in the RGB color space, then add the same minimal positive constant to each coordinate that makes all entries non-negative, and finally, if necessary, divide each coordinate by the maximal coordinate, so that the coordinates are all in the range 0..1.
with⁡ColorTools:
C≔Color⁡0.293,−0.128,0.132
C≔〈*RGB* : 0.293 -0.128 0.132〉
C1≔ToDisplayable⁡C
C1≔〈RGB : 0.215 -0.00176 0.115〉
C2≔ToDisplayable⁡C,mode=Lab
C2≔〈RGB : 0.215 -0.00176 0.115〉
C3≔ToDisplayable⁡C,mode=HSV
C3≔〈RGB : 0.293 0 0.181〉
C4≔ToDisplayable⁡C,mode=RGB
C4≔〈RGB : 0.293 0 0.132〉
C5≔ToDisplayable⁡C,mode=RGBscale
C5≔〈RGB : 0.421 0 0.26〉
Swatches⁡C1,C2,C3,C4,C5,rows=1
The ColorTools[ToDisplayable] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
ColorTools/ColorSpaces
ColorTools[Color]
Download Help Document