ColorTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

ColorTools

  

Blend

  

generate a blend of colors

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Blend(color1..color2, value, options)

Blend(colorlist, value, options)

Parameters

color1,color2

-

colors in formats recognized by ColorTools

colorlist

-

list or Array of colors in formats recognized by ColorTools

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

Options

• 

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.

Description

• 

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 Array 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.

Examples

withColorTools:

Interpolate linearly between white and blue in the default color space.

Blendwhite..blue,23

RGB : 0.333 0.333 1

(1)

Interpolate linearly between white and blue in the HSV color space.

Blendwhite..blue,23,space=HSV

HSV : 0.444 0.667 1

(2)

Interpolate linearly between three colors: red, white, and green.

Blendred,white,green,0.25

RGB : 1 0.5 0.5

(3)

Interpolate linearly with specified thresholds, marking all values <= 0.1 as red and all values >= 0.8 as green.

fBlendred&comma;yellow&comma;green&comma;markers&equals;0.1&comma;0.45&comma;0.8&colon;

seqfi&comma;i&equals;0..1&comma;0.2

RGB : 1 0 0&comma;RGB : 1 0.286 0&comma;RGB : 1 0.857 0&comma;RGB : 0.571 1 0&comma;RGB : 0 1 0&comma;RGB : 0 1 0

(4)

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.

cBlendred..green&comma;12&comma;space&equals;Lab&comma;displayable&equals;false

c*Lab* : 70.5 -3.05 75.2

(5)

ColorRGB&comma;c

*RGB* : 0.786 0.671 -0.0651

(6)

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.

cBlendred..green&comma;12&comma;space&equals;Lab&comma;displayable&equals;true

cLab : 70.5 -3.01 73.2

(7)

ColorRGB&comma;c

RGB : 0.786 0.671 0

(8)

Compatibility

• 

The ColorTools[Blend] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

ColorTools

ColorTools/ColorSpaces

ColorTools[Color]

ColorTools[Gradient]

ColorTools[ToDisplayable]