ColorTools[Palette] - Maple Programming Help

Home : Support : Online Help : Graphics : Packages : ColorTools : Palette Object Commands : ColorTools/Palette/numcolors

ColorTools[Palette]

 numcolors
 retrieve the number of defining colors in a Palette object
 numelems
 retrieve the current total number of colors in a Palette object

 Calling Sequence numcolors(P) numelems(P)

Parameters

 P - Palette object created with ColorTools:-Palette

numcolors

 • The numcolors command returns the number of indexable colors in a Palette object when it was created before any automatic palette expansion.

numelems

 • The numelems command returns the number of colors in a Palette object including any colors added during automatic palette expansion.

Examples

 > $P≔\mathrm{ColorTools}:-\mathrm{GetPalette}\left("spring"\right)$
 ${P}{≔}⟨{Palette Spring:}{}\colorbox[rgb]{0,0.454901960784314,0.8}{{Blue}}{}\colorbox[rgb]{0.8,0,0.454901960784314}{{Rose}}{}\colorbox[rgb]{0.454901960784314,0.8,0}{YellowGreen}{}\colorbox[rgb]{0,0.8,0.745098039215686}{BlueGreen}{}\colorbox[rgb]{0.345098039215686,0,0.8}{{Violet}}{}\colorbox[rgb]{0.294117647058824,0.494117647058824,0.650980392156863}{Cobalt}{}\colorbox[rgb]{0.756862745098039,0.8,0}{Yellow}{}\colorbox[rgb]{0.8,0,0.305882352941176}{{PurpleRed}}{}\colorbox[rgb]{0,0.254901960784314,0.8}{{GreenBlue}}{}\colorbox[rgb]{0.294117647058824,0.650980392156863,0.450980392156863}{PaleGreen}{}\colorbox[rgb]{0.8,0.494117647058824,0}{Orange}{}\colorbox[rgb]{0.745098039215686,0,0.8}{{Purple}}{}\colorbox[rgb]{0,0.8,0.2}{Green}{}\colorbox[rgb]{0,0.654901960784314,0.8}{SeaBlue}{}\colorbox[rgb]{0.607843137254902,0.650980392156863,0.294117647058824}{PaleYellow}{}\colorbox[rgb]{0.294117647058824,0.650980392156863,0.650980392156863}{PaleBlueGreen}⟩$ (1)
 > $\mathrm{numcolors}\left(P\right)$
 ${16}$ (2)
 > $\mathrm{numelems}\left(P\right)$
 ${16}$ (3)
 > $P\left[\mathrm{numcolors}\left(P\right)+10\right]$
 ${⟨}\colorbox[rgb]{0.0117647058823529,0.564705882352941,0.133333333333333}{{RGB : 0.0129 0.566 0.133}}{⟩}$ (4)
 > $\mathrm{numcolors}\left(P\right)$
 ${16}$ (5)
 > $\mathrm{numelems}\left(P\right)$
 ${27}$ (6)

Compatibility

 • The ColorTools[Palette][numcolors] and ColorTools[Palette][numelems] commands were introduced in Maple 16.