ColorTools - Maple Programming Help

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

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). As long as the palette type is not set to 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[\frac{i}{10}\$3\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 2}}{}\colorbox[rgb]{0.301960784313725,0.301960784313725,0.301960784313725}{{Dark Gray 3}}{}\colorbox[rgb]{0.4,0.4,0.4}{{Gray}}{}\colorbox[rgb]{0.501960784313725,0.501960784313725,0.501960784313725}{Gray 2}{}\colorbox[rgb]{0.6,0.6,0.6}{Gray 3}{}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{Light Gray}{}\colorbox[rgb]{0.8,0.8,0.8}{Light Gray 2}{}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{Light Gray 3}{}White⟩$ (1)
 > ${\mathrm{grays}}_{2}$
 ${⟨}\colorbox[rgb]{0.101960784313725,0.101960784313725,0.101960784313725}{{RGB : Dark Gray}}{⟩}$ (2)
 > ${\mathrm{grays}}_{8..-2}$
 $\left[{⟨}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{RGB : Light Gray}{⟩}{,}{⟨}\colorbox[rgb]{0.8,0.8,0.8}{RGB : Light Gray 2}{⟩}{,}{⟨}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{RGB : Light Gray 3}{⟩}\right]$ (3)
 > ${\mathrm{grays}}_{[]}$
 ${⟨}\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 2}}{⟩}{,}{⟨}\colorbox[rgb]{0.301960784313725,0.301960784313725,0.301960784313725}{{RGB : Dark Gray 3}}{⟩}{,}{⟨}\colorbox[rgb]{0.4,0.4,0.4}{{RGB : Gray}}{⟩}{,}{⟨}\colorbox[rgb]{0.501960784313725,0.501960784313725,0.501960784313725}{RGB : Gray 2}{⟩}{,}{⟨}\colorbox[rgb]{0.6,0.6,0.6}{RGB : Gray 3}{⟩}{,}{⟨}\colorbox[rgb]{0.701960784313725,0.701960784313725,0.701960784313725}{RGB : Light Gray}{⟩}{,}{⟨}\colorbox[rgb]{0.8,0.8,0.8}{RGB : Light Gray 2}{⟩}{,}{⟨}\colorbox[rgb]{0.901960784313726,0.901960784313726,0.901960784313726}{RGB : Light Gray 3}{⟩}{,}{⟨}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}}_{"Red"}$
 ${⟨}\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}}_{1..5}$
 $\left[{⟨}\colorbox[rgb]{1,0,0}{{RGB : Red}}{⟩}{,}{⟨}\colorbox[rgb]{0,0,1}{{RGB : Blue}}{⟩}{,}{⟨}\colorbox[rgb]{0,1,0}{RGB : Green}{⟩}{,}{⟨}\colorbox[rgb]{1,0,1}{RGB : 1 0 1}{⟩}{,}{⟨}\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.