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, colormap, fill, line, and point. A dictionary palette is intended to store an association of colors and names. A colormap is optimized for large precomputed gradients. 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.
 • There are many existing Palettes that are Color Collections for use by users and used by many visualization routines.
 • The GetPaletteColors command is the easiest way to get all the colors in the a palette, but there are many advantages to using the object directly.

Creating New Palettes

 • The Palette command is a constructor for a new palette. The simplest usage is to just provide a list of colors.
 • When 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.725490196078431,0.00392156862745098,0}{{RGB : 0.726 0.00359 0}}{⟩}$ (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,0,0.00392156862745098}{{RGB : 0 0.00136 0.00529}}{⟩}{,}{⟨}\colorbox[rgb]{1,0,1}{RGB : 1 0 1}{⟩}\right]$ (8)

Palettes cannot be empty.

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

Compatibility

 • The ColorTools[Palette] command was introduced in Maple 16.