Packagecom.kraftner.geom
Classpublic class Color

Represents one RGBA Color that can be manipulated in different ways.

Instances of this class can be combined to Palettes.

This Class also offers a wide variety of manipulating this RGBA color. Keep in mind that some of these manipulations aren't exact and non-reversible which means that setting a certain value +10 and then -10 doesn't necessarily bring you back to the initial value.

See also

com.kraftner.geom.Palette
com.kraftner.geom.StaticPalette


Public Properties
 PropertyDefined by
  a : Number
alpha part of this Color

Only takes values between 0 and 1, Higher/Lower values are trimmed to 0/1.

Color
  b : Number
blue part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Color
  brightness : Number
brightness of this Color

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Color
  g : Number
green part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Color
  hex : Number
hex representation of this Color
Color
  hue : Number
Hue of this Color

Only takes values between 0 and 360, Higher/Lower values are wrapped to be within 0 and 360: 400 would be 40 and -30 would be 330.

Color
  lightness : Number
lightness of this Color as set by the HSL Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Color
  r : Number
red part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Color
  saturation_HSL : Number
saturation of this Color as set by the HSL Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Color
  saturation_HSV : Number
saturation of this Color as set by the HSV Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Color
  value : Number
value of this Color as set by the HSV Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Color
Public Methods
 MethodDefined by
  
Color(red:Number = 0, green:Number = 0, blue:Number = 0, alpha:Number = 1)
Constructor method
Color
  
Returns a copy of this Color
Color
  
random(randomize_red:Boolean = true, randomize_green:Boolean = true, randomize_blue:Boolean = true, randomize_alpha:Boolean = false):void
Randomly change the red, green, blue and alpha values of this Color.
Color
  
RGBtoHEX(red:Number, green:Number, blue:Number):Number
[static] Converts a RGB color from red, green and blue parts to a HEX representation
Color
  
toString():Number
Returns the hex code of this Color
Color
Property detail
aproperty
a:Number  [read-write]

alpha part of this Color

Only takes values between 0 and 1, Higher/Lower values are trimmed to 0/1.

Implementation
    public function get a():Number
    public function set a(value:Number):void
bproperty 
b:Number  [read-write]

blue part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Implementation
    public function get b():Number
    public function set b(value:Number):void
brightnessproperty 
brightness:Number  [read-write]

brightness of this Color

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Implementation
    public function get brightness():Number
    public function set brightness(value:Number):void
gproperty 
g:Number  [read-write]

green part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Implementation
    public function get g():Number
    public function set g(value:Number):void
hexproperty 
hex:Number  [read-write]

hex representation of this Color

Implementation
    public function get hex():Number
    public function set hex(value:Number):void
hueproperty 
hue:Number  [read-write]

Hue of this Color

Only takes values between 0 and 360, Higher/Lower values are wrapped to be within 0 and 360: 400 would be 40 and -30 would be 330.

Implementation
    public function get hue():Number
    public function set hue(value:Number):void
lightnessproperty 
lightness:Number  [read-write]

lightness of this Color as set by the HSL Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Implementation
    public function get lightness():Number
    public function set lightness(value:Number):void
rproperty 
r:Number  [read-write]

red part of this Color

Only takes values between 0 and 255, Higher/Lower values are trimmed to 0/255.

Implementation
    public function get r():Number
    public function set r(value:Number):void
saturation_HSLproperty 
saturation_HSL:Number  [read-write]

saturation of this Color as set by the HSL Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Implementation
    public function get saturation_HSL():Number
    public function set saturation_HSL(value:Number):void
saturation_HSVproperty 
saturation_HSV:Number  [read-write]

saturation of this Color as set by the HSV Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Implementation
    public function get saturation_HSV():Number
    public function set saturation_HSV(value:Number):void
valueproperty 
value:Number  [read-write]

value of this Color as set by the HSV Colorsystem

Only takes values between 0 and 100, Higher/Lower values are trimmed to 0/100.

Implementation
    public function get value():Number
    public function set value(value:Number):void
Constructor detail
Color()constructor
public function Color(red:Number = 0, green:Number = 0, blue:Number = 0, alpha:Number = 1)

Constructor method

Parameters
red:Number (default = 0) — red value of the RGBA Color
 
green:Number (default = 0) — green value of the RGBA Color
 
blue:Number (default = 0) — blue value of the RGBA Color
 
alpha:Number (default = 1) — alpha value of the RGBA Color
Method detail
clone()method
public function clone():Color

Returns a copy of this Color

Returns
Color — copy of the original Color Instance
random()method 
public function random(randomize_red:Boolean = true, randomize_green:Boolean = true, randomize_blue:Boolean = true, randomize_alpha:Boolean = false):void

Randomly change the red, green, blue and alpha values of this Color.

Parameters
randomize_red:Boolean (default = true)
 
randomize_green:Boolean (default = true)
 
randomize_blue:Boolean (default = true)
 
randomize_alpha:Boolean (default = false)
RGBtoHEX()method 
public static function RGBtoHEX(red:Number, green:Number, blue:Number):Number

Converts a RGB color from red, green and blue parts to a HEX representation

Parameters
red:Number — red part of the RGB color
 
green:Number — green part of the RGB color
 
blue:Number — blue part of the RGB color

Returns
Number — HEX color
toString()method 
public function toString():Number

Returns the hex code of this Color

Returns
Number