ExpandPalette - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

ColorTools

 ExpandPalette
 add matching colors to a palette

 Calling Sequence ExpandPalette(P, opts)

Parameters

 P - list of colors in formats recognized by ColorTools, or a Palette created with ColorTools[Palette] opts - (optional) equation(s) of the form option=value where option is one of number, space, avoid, maxdistance, metric, or maxluma

Options

 • number = posint
 number of new colors to return (the default is 1)
 • space = string
 the color space of the output. By default it is determined from the input.
 • avoid = list
 a list of colors that output colors should be far away from, but should not be used to generate candidate new colors
 • maxdistance = float
 an upperbound on the distance of candidate colors from the input colors
 • metric = {name,string}
 the metric passed to ColorTools[Distance] for calculating the distance from candidate colors to input colors.
 • maxluma = float
 an upperbound on the brightness of candidate colors.  A value of 0.75 is reasonable to make sure plot lines in the colors show up well on white backgrounds.

Description

 • The ExpandPalette command computes additional colors that can be added to a palette. Colors are selected to match well with at least one input color but not be too close to any of the input colors.  The ColorTools commands Lighten, Saturate, Darken, Desaturate, NeutralSpread, and HueSplit are used to generate candidate colors.  The colors are then filtered based on the options to remove undesirable colors.  Then a greedy method is used to select the desired number of candidates that are perceptually far away from the input colors.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{ExpandPalette}\left(\mathrm{GetPalette}\left("MapleV"\right),\mathrm{number}=2\right)$
 $\left[{⟨}\colorbox[rgb]{0.137254901960784,0.490196078431373,0.556862745098039}{{RGB : 0.137 0.488 0.557}}{⟩}{,}{⟨}\colorbox[rgb]{0,0.623529411764706,1}{RGB : 0 0.625 1}{⟩}\right]$ (1)
 > $P≔\mathrm{ExpandPalette}\left(\left["DarkRed","Green","Navy"\right],\mathrm{number}=3\right)$
 ${P}{≔}\left[{⟨}\colorbox[rgb]{0.270588235294118,0.36078431372549,0.56078431372549}{{RGB : 0.269 0.361 0.563}}{⟩}{,}{⟨}\colorbox[rgb]{0.0117647058823529,0.231372549019608,0.00784313725490196}{{RGB : 0.0121 0.233 0.00623}}{⟩}{,}{⟨}\colorbox[rgb]{0.0666666666666667,0.313725490196078,0.909803921568627}{{RGB : 0.0686 0.314 0.91}}{⟩}\right]$ (2)
 > $\mathrm{Swatches}\left(\left["DarkRed","Green","Navy",P\left[\right]\right],\mathrm{rows}=2\right)$

Compatibility

 • The ColorTools[ExpandPalette] command was introduced in Maple 16.
 • For more information on Maple 16 changes, see Updates in Maple 16.