Palette - Maple Help

ColorTools

 Palette
 construct a palette data structure

 Calling Sequence Palette(colors) Palette(colors, palettetype=type )

Parameters

 colors - list of colors in formats recognized by ColorTools, or a list of equations of the form string=color. type - type of palette given as a string. Choices are dictionary, fill, line, and point. A dictionary palette is intended to store an association of colors and names. The other palette types specify a collection of colors intended for use in plotted figures of the given type. In general, darker, more saturated colors are better for points and lines while lighter, less saturated colors are better for fills.

Description

 • A palette data structure is an object that stores a collection of named colors in a specified order.
 • If names are not specified for the colors in the palette, names will be created using the ColorDescription command.
 • The palette structure is primarily used to register new collections of colors using the AddPalette command.
 • As stand-alone objects, palettes recognize the indexing operator [] and can be indexed as if they were lists (using integer indices) or tables (using color name strings).
 • For all palettes except those of type dictionary, when indexed using a higher number than the number of colors specified in the definition, the palette will automatically be extended using the ExpandPalette command.

Examples

 > $\mathrm{with}\left(\mathrm{ColorTools}\right):$
 > $\mathrm{grays}≔\mathrm{Palette}\left(\left[\mathrm{seq}\left(\mathrm{Color}\left(\left[\mathrm{}\left(\frac{i}{10},3\right)\right]\right),i=0..10\right)\right]\right)$
 ${\mathrm{grays}}{≔}⟨{Palette:}{}\colorbox[rgb]{0,0,0}{{Black}}{}\colorbox[rgb]{0.101960784313725,0.101960784313725,0.101960784313725}{{Dark Gray}}{}\colorbox[rgb]{0.2,0.2,0.2}{{Dark Gray 1}}{}\colorbox[rgb]{0.301960784313725,0.301960784313725,0.301960784313725}{{Dark Gray 2}}{}\colorbox[rgb]{0.4,0.4,0.4}{{Gray}}{}\colorbox[rgb]{0.501960784313725,0.501960784313725,0.501960784313725}{Gray 1}{}\colorbox[rgb]{0.6,0.6,0.6}{Gray 2}{}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{Light Gray}{}\colorbox[rgb]{0.8,0.8,0.8}{Light Gray 1}{}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{Light Gray 2}{}White⟩$ (1)
 > $\mathrm{grays}\left[2\right]$
 ${⟨}\colorbox[rgb]{0.101960784313725,0.101960784313725,0.101960784313725}{{RGB : Dark Gray}}{⟩}$ (2)
 > $\mathrm{grays}\left[8..-2\right]$
 $\left[{⟨}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{RGB : Light Gray}{⟩}{,}{⟨}\colorbox[rgb]{0.8,0.8,0.8}{RGB : Light Gray 1}{⟩}{,}{⟨}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{RGB : Light Gray 2}{⟩}\right]$ (3)
 > $\mathrm{grays}\left[\right]$
 ${⟨}\colorbox[rgb]{0,0,0}{{RGB : Black}}{⟩}{,}{⟨}\colorbox[rgb]{0.101960784313725,0.101960784313725,0.101960784313725}{{RGB : Dark Gray}}{⟩}{,}{⟨}\colorbox[rgb]{0.2,0.2,0.2}{{RGB : Dark Gray 1}}{⟩}{,}{⟨}\colorbox[rgb]{0.301960784313725,0.301960784313725,0.301960784313725}{{RGB : Dark Gray 2}}{⟩}{,}{⟨}\colorbox[rgb]{0.4,0.4,0.4}{{RGB : Gray}}{⟩}{,}{⟨}\colorbox[rgb]{0.501960784313725,0.501960784313725,0.501960784313725}{RGB : Gray 1}{⟩}{,}{⟨}\colorbox[rgb]{0.6,0.6,0.6}{RGB : Gray 2}{⟩}{,}{⟨}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{RGB : Light Gray}{⟩}{,}{⟨}\colorbox[rgb]{0.8,0.8,0.8}{RGB : Light Gray 1}{⟩}{,}{⟨}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{RGB : Light Gray 2}{⟩}{,}{⟨}RGB : White{⟩}$ (4)
 > $\mathrm{primary}≔\mathrm{Palette}\left(\left["Red"=\mathrm{Color}\left("#f00"\right),"Blue"=\mathrm{Color}\left("#00f"\right),"Green"=\mathrm{Color}\left("#0f0"\right)\right],\mathrm{palettetype}="fill"\right)$
 ${\mathrm{primary}}{≔}⟨{Palette:}{}\colorbox[rgb]{1,0,0}{{Red}}{}\colorbox[rgb]{0,0,1}{{Blue}}{}\colorbox[rgb]{0,1,0}{Green}⟩$ (5)
 > $\mathrm{primary}\left["Red"\right]$
 ${⟨}\colorbox[rgb]{1,0,0}{{RGB : Red}}{⟩}$ (6)
 > $\mathrm{Swatches}\left(\mathrm{primary},\mathrm{rows}=1\right)$

Automatic transformations of colors may be done on non-dictionary palettes.

 > $\mathrm{Lookup}\left(\mathrm{primary},"Red",\mathrm{shade}="point"\right)$
 ${⟨}\colorbox[rgb]{0.807843137254902,0.176470588235294,0.0901960784313725}{{RGB : 0.806 0.176 0.0894}}{⟩}$ (7)

Non-dictionary palettes can be automatically expanded.

 > $\mathrm{primary}\left[1..5\right]$
 $\left[{⟨}\colorbox[rgb]{1,0,0}{{RGB : Red}}{⟩}{,}{⟨}\colorbox[rgb]{0,0,1}{{RGB : Blue}}{⟩}{,}{⟨}\colorbox[rgb]{0,1,0}{RGB : Green}{⟩}{,}{⟨}\colorbox[rgb]{0.733333333333333,0.603921568627451,0.968627450980392}{RGB : 0.732 0.602 0.969}{⟩}{,}{⟨}\colorbox[rgb]{0,1,1}{RGB : 0 1 1}{⟩}\right]$ (8)

Palettes cannot be empty.

 > $\mathrm{Palette}\left(\left[\right]\right)$

Compatibility

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