ColorTools
Gradient
generate a selection of intermediate colors
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Gradient(color1..color2)
color1,color2
-
colors in formats recognized by ColorTools
number=nonnegint
the number of intermediate colors to compute (default is 10)
space=string
the color space in which to compute the intermediate colors. By default this is inferred from the colors spaces of the input.
best
if this keyword is given, a heuristic is used to get a well-spaced set of colors using the Jab perceptual color space.
displayable
if this keyword is given, then each output color will be displayable
The Gradient command computes a number of intermediate colors that transition between the two colors in the input range.
with(ColorTools):
G := Gradient("Red".."Blue");
G≔〈RGB : 1 0 0〉,〈RGB : 0.909 0 0.0909〉,〈RGB : 0.818 0 0.182〉,〈RGB : 0.727 0 0.273〉,〈RGB : 0.636 0 0.364〉,〈RGB : 0.545 0 0.455〉,〈RGB : 0.455 0 0.545〉,〈RGB : 0.364 0 0.636〉,〈RGB : 0.273 0 0.727〉,〈RGB : 0.182 0 0.818〉,〈RGB : 0.0909 0 0.909〉,〈RGB : 0 0 1〉
H := Gradient("Red".."Blue", best);
H≔〈RGB : 1 0 0〉,〈RGB : 0.905 0.198 0.179〉,〈RGB : 0.813 0.265 0.279〉,〈RGB : 0.722 0.303 0.357〉,〈RGB : 0.635 0.324 0.416〉,〈RGB : 0.552 0.334 0.459〉,〈RGB : 0.478 0.334 0.487〉,〈RGB : 0.412 0.324 0.516〉,〈RGB : 0.346 0.306 0.563〉,〈RGB : 0.268 0.281 0.641〉,〈RGB : 0.161 0.234 0.77〉,〈RGB : 0 0 1〉
Swatches([G[], H[]], rows=2);
The ColorTools[Gradient] command was introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
The ColorTools[Gradient] command was updated in Maple 2023.
The best option was updated in Maple 2023.
See Also
ColorTools/ColorSpaces
ColorTools[AnalogousSpread]
ColorTools[Color]
ColorTools[EvenSpread]
ColorTools[GraySpread]
ColorTools[HueSpread]
ColorTools[NeutralSpread]
Download Help Document