Packagecom.yahoo.astra.utils
Classpublic class ColorUtil

Utility functions for working with color values.

See also

com.yahoo.astra.utils.IColor


Public Methods
 MethodDefined by
  
[static] Converts an CMYK color value to the CMY colorspace.
ColorUtil
  
[static] Converts an CMYK color value to the HSB colorspace.
ColorUtil
  
[static] Converts an CMYK color value to the RGB colorspace.
ColorUtil
  
CMYKTouint(cmyk:CMYKColor):uint
[static] Converts an CMYK color value to a standard uint color value.
ColorUtil
  
[static] Converts an CMY color value to the CMYK colorspace.
ColorUtil
  
[static] Converts an CMY color value to the HSB colorspace.
ColorUtil
  
[static] Converts an CMY color value to the RGB colorspace.
ColorUtil
  
CMYTouint(cmy:CMYColor):uint
[static] Converts an CMY color value to a standard uint color value.
ColorUtil
  
[static] Converts an HSB color value to the CMYcolorspace.
ColorUtil
  
[static] Converts an HSB color value to the CMYK colorspace.
ColorUtil
  
[static] Converts an HSB color value to the RGB colorspace.
ColorUtil
  
HSBTouint(hsb:HSBColor):uint
[static] Converts an HSB color value to a standard uint color value.
ColorUtil
  
[static] Converts an RGB color value to the CMY colorspace.
ColorUtil
  
[static] Converts an RGB color value to the CMYK colorspace.
ColorUtil
  
[static] Converts an RGB color value to the HSB colorspace.
ColorUtil
  
RGBTouint(rgb:RGBColor):uint
[static] Converts an RGB color value to a standard uint color value.
ColorUtil
  
toHexString(value:uint):String
[static] Converts a uint color value to a hex string.
ColorUtil
  
uintToCMY(color:uint):CMYColor
[static] Converts an uint color value to the CMY colorspace.
ColorUtil
  
uintToCMYK(color:uint):CMYKColor
[static] Converts a uint color value to the CMYK colorspace.
ColorUtil
  
uintToHSB(color:uint):HSBColor
[static] Converts a uint color value to the HSB colorspace.
ColorUtil
  
uintToRGB(color:uint):RGBColor
[static] Converts a uint color value to the RGB colorspace.
ColorUtil
  
whiteOrBlack(value:uint):uint
[static] Determines if white (0xfffff) or black (0x000000) is a better color to display over the specified color value.
ColorUtil
Method detail
CMYKToCMY()method
public static function CMYKToCMY(cmyk:CMYKColor):CMYColor

Converts an CMYK color value to the CMY colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
cmyk:CMYKColor — the input CMYK value

Returns
CMYColor — the value converted to CMY
CMYKToHSB()method 
public static function CMYKToHSB(cmyk:CMYKColor):HSBColor

Converts an CMYK color value to the HSB colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
cmyk:CMYKColor — the input CMYK value

Returns
HSBColor — the value converted to HSB
CMYKToRGB()method 
public static function CMYKToRGB(cmyk:CMYKColor):RGBColor

Converts an CMYK color value to the RGB colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
cmyk:CMYKColor — the input CMYK value

Returns
RGBColor — the value converted to RGB
CMYKTouint()method 
public static function CMYKTouint(cmyk:CMYKColor):uint

Converts an CMYK color value to a standard uint color value.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
cmyk:CMYKColor — the input CMYK value

Returns
uint — the value converted to uint
CMYToCMYK()method 
public static function CMYToCMYK(cmy:CMYColor):CMYKColor

Converts an CMY color value to the CMYK colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
cmy:CMYColor — the input CMY value

Returns
CMYKColor — the value converted to CMYK
CMYToHSB()method 
public static function CMYToHSB(cmy:CMYColor):HSBColor

Converts an CMY color value to the HSB colorspace.

Parameters
cmy:CMYColor — the input CMY value

Returns
HSBColor — the value converted to HSB
CMYToRGB()method 
public static function CMYToRGB(cmy:CMYColor):RGBColor

Converts an CMY color value to the RGB colorspace.

Parameters
cmy:CMYColor — the input CMY value

Returns
RGBColor — the value converted to RGB
CMYTouint()method 
public static function CMYTouint(cmy:CMYColor):uint

Converts an CMY color value to a standard uint color value.

Parameters
cmy:CMYColor — the input CMY value

Returns
uint — the value converted to uint
HSBToCMY()method 
public static function HSBToCMY(hsb:HSBColor):CMYColor

Converts an HSB color value to the CMYcolorspace.

Parameters
hsb:HSBColor — the input HSB value

Returns
CMYColor — the value converted to CMY
HSBToCMYK()method 
public static function HSBToCMYK(hsb:HSBColor):CMYKColor

Converts an HSB color value to the CMYK colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
hsb:HSBColor — the input HSB value

Returns
CMYKColor — the value converted to CMYK
HSBToRGB()method 
public static function HSBToRGB(hsb:HSBColor):RGBColor

Converts an HSB color value to the RGB colorspace.

Parameters
hsb:HSBColor — the input HSB value

Returns
RGBColor — the value converted to RGB
HSBTouint()method 
public static function HSBTouint(hsb:HSBColor):uint

Converts an HSB color value to a standard uint color value.

Parameters
hsb:HSBColor — the input HSB value

Returns
uint — the value converted to uint
RGBToCMY()method 
public static function RGBToCMY(rgb:RGBColor):CMYColor

Converts an RGB color value to the CMY colorspace.

Parameters
rgb:RGBColor — the input RGB value

Returns
CMYColor — the value converted to CMY
RGBToCMYK()method 
public static function RGBToCMYK(rgb:RGBColor):CMYKColor

Converts an RGB color value to the CMYK colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
rgb:RGBColor — the input RGB value

Returns
CMYKColor — the value converted to CMYK
RGBToHSB()method 
public static function RGBToHSB(rgb:RGBColor):HSBColor

Converts an RGB color value to the HSB colorspace.

Parameters
rgb:RGBColor — the input RGB value

Returns
HSBColor — the value converted to HSB
RGBTouint()method 
public static function RGBTouint(rgb:RGBColor):uint

Converts an RGB color value to a standard uint color value.

Parameters
rgb:RGBColor — the input RGB value

Returns
uint — the value converted to uint
toHexString()method 
public static function toHexString(value:uint):String

Converts a uint color value to a hex string.

Format: XXXXXX, where X is a value between 0-F.

Parameters
value:uint — the uint to convert

Returns
String — the converted value as a hex string
uintToCMY()method 
public static function uintToCMY(color:uint):CMYColor

Converts an uint color value to the CMY colorspace.

Parameters
color:uint — the input uint color value

Returns
CMYColor — the value converted to CMY
uintToCMYK()method 
public static function uintToCMYK(color:uint):CMYKColor

Converts a uint color value to the CMYK colorspace.

(Note: In practice, color values in the CMYK colorspace must be calculated based on environmental information. This algorithm provides, at best, nothing more than an approximation.)

Parameters
color:uint — the input uint color value

Returns
CMYKColor — the value converted to CMYK
uintToHSB()method 
public static function uintToHSB(color:uint):HSBColor

Converts a uint color value to the HSB colorspace.

Parameters
color:uint — the input uinnt color value

Returns
HSBColor — the value converted to HSB
uintToRGB()method 
public static function uintToRGB(color:uint):RGBColor

Converts a uint color value to the RGB colorspace.

Parameters
color:uint — the input uint color value

Returns
RGBColor — the value converted to RGB
whiteOrBlack()method 
public static function whiteOrBlack(value:uint):uint

Determines if white (0xfffff) or black (0x000000) is a better color to display over the specified color value. Use case: Text color over a background color.

Parameters
value:uint — the input color value

Returns
uint — black or white (0x000000 or 0xffffff).