Color

public class
loom2d.math.Color

Description

A very simple Color class. Also has helpful methods for converting different representations of colors.

API overview

Constructor

Color ( r: Number = 0 , g: Number = 0 , b: Number = 0 , a: Number = 255 )
Allows easy creation of colors RGBA color representations

Attributes

Public attributes

alpha: Number
blue: Number
green: Number
red: Number

Functions

Public functions

fromHex ( value: String ): Color static

Decode a color from a hex string value, ie, #FF00FF

fromInt ( value: Number ): Color static

Decode a color from an integer, ie, 0xFF00FF

fromInteger ( value: Number ): Color static

Decode a color from an integer, ie, 0xFF00FF

random (): Color static

Returns a random color

toHex ( prepend: String = # ): String

Return the color as a hex string representation, ie, #FF00FF

toInt (): Number

Return the color as an integer representation, ie, 0 - 16777215

Constructor

Color ( r: Number = 0 , g: Number = 0 , b: Number = 0 , a: Number = 255 )

Allows easy creation of colors RGBA color representations. @param r red value 0 - 255 @param g green value 0 - 255 @param b blue value 0 - 255 @param a alpha value 0 - 255

Attributes

alpha: Number

blue: Number

green: Number

red: Number

Functions

fromHex ( value: String ): Color

static

Decode a color from a hex string value, ie, #FF00FF.

Parameters

value: String


fromInt ( value: Number ): Color

static

Decode a color from an integer, ie, 0xFF00FF.

Parameters

value: Number


fromInteger ( value: Number ): Color

static

Decode a color from an integer, ie, 0xFF00FF.

Parameters

value: Number


getFullTypeName (): String
Inherited from Object

native

Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.


Returns

String fully qualified type name of the Object.

getType (): Type
Inherited from Object

native

Gets the Type that describes the Object.


Returns

Type The Type that describes the object.

getTypeName (): String
Inherited from Object

native

Gets the type name of the Object.


Returns

String type name of the Object.

random (): Color

static

Returns a random color.



toHex ( prepend: String = # ): String

Return the color as a hex string representation, ie, #FF00FF.

Parameters

prepend: String = # String to prepend to the beginning of the return value.

Returns

String A hexidecimal representation of the color prepended with passed in prepend param.

toInt (): Number

Return the color as an integer representation, ie, 0 - 16777215.



toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

: