ColorNameTable

Table of color names and values as recognized in IE4+, SVG, etc.  Lookup of both names and values is implemented.

Summary
ColorNameTableTable of color names and values as recognized in IE4+, SVG, etc.
Color names
Color table properties
numColorsNumber of colors defined in the color table.
Lookup methods
lookupColorNameLooks up a color name for the given color value.
lookupColorValueLooks up a color value for the given color name.
hasColorValueTests if the color value has a name defined.
hasColorNameTests if the color name is defined.
Conversion
parseColorConverts the string representing a color to a color value.
toStringConverts the color value into a named or hexadecimal string representation.
toHexConverts the color value into a hexadecimal string representation.
Internal reverse lookup table
valuesAssociative array of color values and names for reverse lookup
Internal static class initialization
staticTypeInfoTemporary used to hold type information about the class itself.
colorNameTemporary used to hold the name of a color during initialization.

Color names

Color table properties

numColors

public static var numColors: int

Number of colors defined in the color table.  This value is initialized by the class static initalizer.

Lookup methods

lookupColorName

public static function lookupColorName(color: uint):String

Looks up a color name for the given color value.

Parameter

colora uint color value

Returns

A color name or null if the color value has no name

lookupColorValue

public static function lookupColorValue(colorName: String):uint

Looks up a color value for the given color name.  The lookup is case insensitive.  Name lookup can also be performed with the static properties on the class for example ColorNameTable.black.

Parameter

colora name of a defined color

Returns

A color value or 0 (black) if the color name is not defined

hasColorValue

public static function hasColorValue(color: uint):Boolean

Tests if the color value has a name defined.

Parameter

colora uint color value

Returns

True if a name is defined for the color, false otherwise.

hasColorName

public static function hasColorName(colorName: String):Boolean

Tests if the color name is defined.

Parameter

colorNamea color name string

Returns

True if the name is defined, false otherwise.

Conversion

parseColor

public static function parseColor(colorString: String):uint

Converts the string representing a color to a color value.  The string can contain a color name (case insensitive), a hex (0x or # prefixed) or a decimal number.

Parameters

colorStringa string representing a color

See Also

toString

toString

public static function toString(color: uint):String

Converts the color value into a named or hexadecimal string representation.  If hex then the string is prefixed with 0x and contains 6 hexadecimal digits.

Returns

Color name or hexadecimal string representing the color in a form that is compatible with parseColor

toHex

public static function toHex(color: uint):String

Converts the color value into a hexadecimal string representation.  The string is prefixed with 0x and contains 6 hexadecimal digits.

Returns

Color name or hexadecimal string representing the color in a form that is compatible with parseColor

Internal reverse lookup table

values

private static var values: Object

Associative array of color values and names for reverse lookup

Internal static class initialization

staticTypeInfo

private static var staticTypeInfo: XML

Temporary used to hold type information about the class itself.

colorName

private static var colorName: String

Temporary used to hold the name of a color during initialization.

public static var numColors: int
Number of colors defined in the color table.
public static function lookupColorName(color: uint):String
Looks up a color name for the given color value.
public static function lookupColorValue(colorName: String):uint
Looks up a color value for the given color name.
public static function hasColorValue(color: uint):Boolean
Tests if the color value has a name defined.
public static function hasColorName(colorName: String):Boolean
Tests if the color name is defined.
public static function parseColor(colorString: String):uint
Converts the string representing a color to a color value.
public static function toString(color: uint):String
Converts the color value into a named or hexadecimal string representation.
public static function toHex(color: uint):String
Converts the color value into a hexadecimal string representation.
private static var values: Object
Associative array of color values and names for reverse lookup
private static var staticTypeInfo: XML
Temporary used to hold type information about the class itself.
private static var colorName: String
Temporary used to hold the name of a color during initialization.
Close