Packagecom.kraftner.geom
Classpublic class Palette
SubclassesDynamicPaletteHueCircle, DynamicPaletteRandom, StaticPalette

Template for all kinds of Palettes.

This Class defines the base functionality of all Palettes which includes sorting methods and access to the contained colors.

This Class should not be instantiated directly. Use child classes like StaticPalette instead.

See also

com.kraftner.geom.StaticPalette


Public Properties
 PropertyDefined by
  length : uint
[read-only] Number of Colors on this Palette
Palette
Protected Properties
 PropertyDefined by
  palette : Vector
Holds the Color Objects of this palette.
Palette
Public Methods
 MethodDefined by
  
Constructor method.
Palette
  
Returns a Color Object representing the average color of this Palette
Palette
  
Returns a copy of this Palette
Palette
  
Returns the current Color of this Palette.
Palette
  
getIndex(index:uint, movePointer:Boolean = true):Color
Returns the color at a certain position of this Palette.
Palette
  
Returns the next Color of this Palette.
Palette
  
Returns the previous Color of this Palette.
Palette
  
sortByBlue():void
Sorts the Colors of this Palette by the blue part of the contained Colors.
Palette
  
Sorts the Colors of this Palette by the brightness of the contained Colors.
Palette
  
sortByGreen():void
Sorts the Colors of this Palette by the green part of the contained Colors.
Palette
  
sortByHEX():void
Sorts the Colors of this Palette by the HEX value of the contained Colors.
Palette
  
sortByHue():void
Sorts the Colors of this Palette by the Hue of the contained Colors
Palette
  
Sorts the Colors of this Palette by the lightness (as set by the HSL Colorsystem) of the contained Colors.
Palette
  
sortByProximity(color:Color):void
Sorts the Colors of this Palette by the proximity of the contained Colors to a certain Color
Palette
  
sortByRed():void
Sorts the Colors of this Palette by the red part of the contained Colors.
Palette
  
Sorts the Colors of this Palette by the saturation (as set by the HSL Colorsystem) of the contained Colors.
Palette
  
Sorts the Colors of this Palette by the saturation (as set by the HSV Colorsystem) of the contained Colors.
Palette
  
sortByValue():void
Sorts the Colors of this Palette by the value (as set by the HSV Colorsystem) of the contained Colors.
Palette
Protected Methods
 MethodDefined by
  
extend(index:uint):void
Defines the rule by which a Palette extends itself when the end is reached.
Palette
Property detail
lengthproperty
length:uint  [read-only]

Number of Colors on this Palette

Implementation
    public function get length():uint
paletteproperty 
protected var palette:Vector

Holds the Color Objects of this palette.

Constructor detail
Palette()constructor
public function Palette()

Constructor method. This Class should not be instantiated directly. Use child classes like StaticPalette instead.

See also

Method detail
average()method
public function average():Color

Returns a Color Object representing the average color of this Palette

Returns
Color — average Color
clone()method 
public function clone():Palette

Returns a copy of this Palette

Returns
Palette — copy of the original Palette Instance
current()method 
public function current():Color

Returns the current Color of this Palette.

Returns
Color — current Color Object

See also

extend()method 
protected function extend(index:uint):void

Defines the rule by which a Palette extends itself when the end is reached.

Parameters
index:uint

See also

getIndex()method 
public function getIndex(index:uint, movePointer:Boolean = true):Color

Returns the color at a certain position of this Palette.

Parameters
index:uint — Index of the Color to get.

If the index is out of range and the extend function doesn't extend the Palette the first Color of the Palette is returned.

 
movePointer:Boolean (default = true) — Change the pointer to the Color that is returned.

Returns
Color — Color Object at the index-Position

See also

next()method 
public function next():Color

Returns the next Color of this Palette. This moves the pointer of this palette to the next Color.

Returns
Color — next Color Object

See also

prev()method 
public function prev():Color

Returns the previous Color of this Palette. This moves the pointer of this palette to the previous Color.

Returns
Color — previous Color Object

See also

sortByBlue()method 
public function sortByBlue():void

Sorts the Colors of this Palette by the blue part of the contained Colors.

sortByBrightness()method 
public function sortByBrightness():void

Sorts the Colors of this Palette by the brightness of the contained Colors.

sortByGreen()method 
public function sortByGreen():void

Sorts the Colors of this Palette by the green part of the contained Colors.

sortByHEX()method 
public function sortByHEX():void

Sorts the Colors of this Palette by the HEX value of the contained Colors.

The result of this might be unexpected and of little practical usefullness, but for matters of completeness this sorting Method is still offered.

sortByHue()method 
public function sortByHue():void

Sorts the Colors of this Palette by the Hue of the contained Colors

sortByLightness()method 
public function sortByLightness():void

Sorts the Colors of this Palette by the lightness (as set by the HSL Colorsystem) of the contained Colors.

sortByProximity()method 
public function sortByProximity(color:Color):void

Sorts the Colors of this Palette by the proximity of the contained Colors to a certain Color

Parameters
color:Color
sortByRed()method 
public function sortByRed():void

Sorts the Colors of this Palette by the red part of the contained Colors.

sortBySaturationHSL()method 
public function sortBySaturationHSL():void

Sorts the Colors of this Palette by the saturation (as set by the HSL Colorsystem) of the contained Colors.

sortBySaturationHSV()method 
public function sortBySaturationHSV():void

Sorts the Colors of this Palette by the saturation (as set by the HSV Colorsystem) of the contained Colors.

sortByValue()method 
public function sortByValue():void

Sorts the Colors of this Palette by the value (as set by the HSV Colorsystem) of the contained Colors.