ColorTools
Blend
generate a blend of colors
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Blend(color1..color2, value, options)
Blend(colorlist, value, options)
color1,color2
-
colors in formats recognized by ColorTools
colorlist
list or Array of colors in formats recognized by ColorTools or a palette name or Palette object
value
(optional) value between 0 and 1; sample point
options
(optional) equation(s) of the form option=value where option is one of space, markers, or displayable
displayable=truefalse := false
If this keyword is given then each output color will be displayable, and when represented in the "RGB" color space all three component values of each output color will be between 0 and 1. The default value for this option is false.
markers=list or Array
The parameter thresholds corresponding to each of the specified input colors.
space=string
The color space in which to compute the intermediate colors; if unspecified, this is inferred from the colors spaces of the input when possible, defaulting to "RGB" otherwise.
The Blend command generates a blend of the specified colors.
The first parameter specifies the colors to blend. This may be a range color1..color2 or a list or palette of colors.
The second parameter value specifies a point at which to interpolate.
For example, Blend(red..blue,3/4) will produce a blend of 3/4 blue and 1/4 red.
with⁡ColorTools:
Interpolate linearly between white and blue in the default color space.
Blend⁡white..blue,23
〈RGB : 0.333 0.333 1〉
Interpolate linearly between white and blue in the HSV color space.
Blend⁡white..blue,23,space=HSV
〈HSV : 0.444 0.667 1〉
Interpolate linearly between three colors: red, white, and green.
Blend⁡red,white,green,0.25
〈RGB : 1 0.5 0.5〉
Interpolate linearly with specified thresholds, marking all values <= 0.1 as red and all values >= 0.8 as green.
f≔Blend⁡red,yellow,green,markers=0.1,0.45,0.8:
seq⁡f⁡i,i=0..1,0.2
〈RGB : 1 0 0〉,〈RGB : 1 0.286 0〉,〈RGB : 1 0.857 0〉,〈RGB : 0.571 1 0〉,〈RGB : 0 1 0〉,〈RGB : 0 1 0〉
The color halfway in the "Lab" color space between red and green is not displayable. Note that after conversion to the "RGB" color space the blue component is negative and so not between 0 and 1. This is the default behavior of the Blend command.
c≔Blend⁡red..green,12,space=Lab,displayable=false
c≔〈*Lab* : 70.5 -3.03 75.2〉
Color⁡RGB,c
〈*RGB* : 0.786 0.671 -0.0653〉
The displayable option forces the result above to be a color that is displayable in the "RGB" color space. Note that the blue component is now between 0 and 1.
c≔Blend⁡red..green,12,space=Lab,displayable=true
c≔〈Lab : 70.5 -2.95 73.1〉
〈RGB : 0.786 0.671 0〉
The ColorTools[Blend] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
The ColorTools[Blend] command was updated in Maple 2022.
The colorlist parameter was updated in Maple 2022.
See Also
ColorTools/ColorSpaces
ColorTools[Color]
ColorTools[Gradient]
ColorTools[ToDisplayable]
Download Help Document