Packageflare.util
Classpublic class Colors

Utility methods for working with colors.



Public Properties
 PropertyDefined by
  desaturationMatrix : Array
[static][read-only] A color transform matrix that desaturates colors to corresponding grayscale values.
Colors
Public Methods
 MethodDefined by
  
Constructor, throws an error if called, as this is an abstract class.
Colors
  
a(c:uint):uint
[static] Returns the alpha component of a color value
Colors
  
b(c:uint):uint
[static] Returns the blue component of a color value
Colors
  
brighter(c:uint, s:Number = 1):uint
[static] Get a brighter shade of an input color.
Colors
  
darker(c:uint, s:Number = 1):uint
[static] Get a darker shade of an input color.
Colors
  
desaturate(c:uint):uint
[static] Get a desaturated shade of an input color.
Colors
  
g(c:uint):uint
[static] Returns the green component of a color value
Colors
  
gray(v:uint, a:uint = 255):uint
[static] Returns a grayscale color value with the given brightness
Colors
  
hsv(h:Number, s:Number, v:Number, a:uint = 255):uint
[static] Returns the RGB color value for a color specified in HSV (hue, saturation, value) color space.
Colors
  
hue(c:uint):Number
[static] Returns the hue component of an ARGB color.
Colors
  
interpolate(c1:uint, c2:uint, f:Number):uint
[static] Interpolate between two color values by the given mixing proportion.
Colors
  
r(c:uint):uint
[static] Returns the red component of a color value
Colors
  
rgba(r:uint, g:uint, b:uint, a:uint = 255):uint
[static] Returns a color value with the given red, green, blue, and alpha components
Colors
  
saturation(c:uint):Number
[static] Returns the saturation component of an ARGB color.
Colors
  
setAlpha(c:uint, a:uint):uint
[static] Returns a color value by updating the alpha component of another color value.
Colors
  
value(c:uint):Number
[static] Returns the value (brightness) component of an ARGB color.
Colors
Property detail
desaturationMatrixproperty
desaturationMatrix:Array  [read-only]

A color transform matrix that desaturates colors to corresponding grayscale values. Can be used with the flash.filters.ColorMatrixFilter class.

Implementation
    public static function get desaturationMatrix():Array
Constructor detail
Colors()constructor
public function Colors()

Constructor, throws an error if called, as this is an abstract class.

Method detail
a()method
public static function a(c:uint):uint

Returns the alpha component of a color value

Parameters
c:uint — the color value

Returns
uint — the alpha component
b()method 
public static function b(c:uint):uint

Returns the blue component of a color value

Parameters
c:uint — the color value

Returns
uint — the blue component
brighter()method 
public static function brighter(c:uint, s:Number = 1):uint

Get a brighter shade of an input color.

Parameters
c:uint — a color value
 
s:Number (default = 1)

Returns
uint — a brighter color value
darker()method 
public static function darker(c:uint, s:Number = 1):uint

Get a darker shade of an input color.

Parameters
c:uint — a color value
 
s:Number (default = 1)

Returns
uint — a darkened color value
desaturate()method 
public static function desaturate(c:uint):uint

Get a desaturated shade of an input color.

Parameters
c:uint — a color value

Returns
uint — a desaturated color value
g()method 
public static function g(c:uint):uint

Returns the green component of a color value

Parameters
c:uint — the color value

Returns
uint — the green component
gray()method 
public static function gray(v:uint, a:uint = 255):uint

Returns a grayscale color value with the given brightness

Parameters
v:uint — the brightness component (0-255)
 
a:uint (default = 255) — the alpha component (0-255, 255 by default)

Returns
uint — the color value
hsv()method 
public static function hsv(h:Number, s:Number, v:Number, a:uint = 255):uint

Returns the RGB color value for a color specified in HSV (hue, saturation, value) color space.

Parameters
h:Number — the hue, a value between 0 and 1
 
s:Number — the saturation, a value between 0 and 1
 
v:Number — the value (brighntess), a value between 0 and 1
 
a:uint (default = 255) — the (optional) alpha value, an integer between 0 and 255 (255 is the default)

Returns
uint — the corresponding RGB color value
hue()method 
public static function hue(c:uint):Number

Returns the hue component of an ARGB color.

Parameters
c:uint — the input color

Returns
Number — the hue component of the color is HSV color space as a number between 0 and 1
interpolate()method 
public static function interpolate(c1:uint, c2:uint, f:Number):uint

Interpolate between two color values by the given mixing proportion. A mixing fraction of 0 will result in c1, a value of 1.0 will result in c2, and value of 0.5 will result in the color mid-way between the two in RGB color space.

Parameters
c1:uint — the starting color
 
c2:uint — the target color
 
f:Number — a fraction between 0 and 1 controlling the interpolation

Returns
uint — the interpolated color
r()method 
public static function r(c:uint):uint

Returns the red component of a color value

Parameters
c:uint — the color value

Returns
uint — the red component
rgba()method 
public static function rgba(r:uint, g:uint, b:uint, a:uint = 255):uint

Returns a color value with the given red, green, blue, and alpha components

Parameters
r:uint — the red component (0-255)
 
g:uint — the green component (0-255)
 
b:uint — the blue component (0-255)
 
a:uint (default = 255) — the alpha component (0-255, 255 by default)

Returns
uint — the color value
saturation()method 
public static function saturation(c:uint):Number

Returns the saturation component of an ARGB color.

Parameters
c:uint — the input color

Returns
Number — the saturation of the color is HSV color space as a number between 0 and 1
setAlpha()method 
public static function setAlpha(c:uint, a:uint):uint

Returns a color value by updating the alpha component of another color value.

Parameters
c:uint — a color value
 
a:uint — the desired alpha component (0-255)

Returns
uint — a color value with adjusted alpha component
value()method 
public static function value(c:uint):Number

Returns the value (brightness) component of an ARGB color.

Parameters
c:uint — the input color

Returns
Number — the value component of the color is HSV color space as a number between 0 and 1