EMS.Color

Summary
EMS.Color
Properties
green{Integer} Green value of the color.
blue{Integer} Blue value of the color.
red{Integer} Red value of the color.
Constructor
EMS.Color
Functions
equals
clone{EMS.Color} Returns a clone of this color.
toString{String} Returns a string form of the color.
brigher{EMS.Color} Returns a color that is brigher than this color.
darker{EMS.Color} Returns a color that is darker than this color.
toHex{String} hex representation of the color.
toArray{Array} Returns the colors as an array, in the index order or red, green, blue.
Static Functions
getColorStatic method for getting a named color.
Constants
WHITE
BLACK
RED
BLUE
GREEN
YELLOW
MAGENTA
CYAN

Properties

green

{Integer} Green value of the color.

blue

{Integer} Blue value of the color.

red

{Integer} Red value of the color.

Constructor

EMS.Color

Examples

var red   = new EMS.Color("FF0000");
var blue  = new EMS.Color(0, 0 255);
var green = new EMS.Color("00", "FF", "00");
var white = new EMS.Color("#FFFFFF");
var black = new EMS.Color(["00", "00", "00"]);

Parameters

color{Mixed} this is either a single {String} which is the 6 character hex value, 3 {Integer} values between 0 and 256 representing each of the color values, 3 two character hex values or an array of integers or hex characters.

Functions

equals

Parameters

color{Mixed} This may be an EMS.Color, a hex {String} or just an {Object} with the three color properties set.

Returns

{Boolean} Returns true if the input object is considered equal to this color.

clone

clone: function()

Returns

{EMS.Color} Returns a clone of this color.

toString

toString: function()

Returns

{String} Returns a string form of the color.  This actually calls EMS.Color.toHex.

brigher

Returns

{EMS.Color} Returns a color that is brigher than this color.

darker

darker: function()

Returns

{EMS.Color} Returns a color that is darker than this color.

toHex

toHex: function()

Returns

{String} hex representation of the color.

toArray

toArray: function()

Returns

{Array} Returns the colors as an array, in the index order or red, green, blue.  This will always return an {Array} of length 3.

Static Functions

getColor

EMS.Color.getColor = function(color)

Static method for getting a named color.

Parameters

color{String} is the name of the color to try and find.

Returns

{EMS.Color} if there is a color by the given name, otherwise it will return null.

Constants

WHITE

This is equivalent to

new EMS.Color("FFFFFF");

BLACK

This is equivalent to

new EMS.Color("000000");

RED

This is equivalent to

new EMS.Color("FF0000");

BLUE

This is equivalent to

new EMS.Color("0000FF");

GREEN

This is equivalent to

new EMS.Color("00FF00");

YELLOW

This is equivalent to

new EMS.Color("FFFF00");

MAGENTA

This is equivalent to

new EMS.Color("FF00FF");

CYAN

This is equivalent to

new EMS.Color("00FFFF");
clone: function()
{EMS.Color} Returns a clone of this color.
toString: function()
{String} Returns a string form of the color.
darker: function()
{EMS.Color} Returns a color that is darker than this color.
toHex: function()
{String} hex representation of the color.
toArray: function()
{Array} Returns the colors as an array, in the index order or red, green, blue.
EMS.Color.getColor = function(color)
Static method for getting a named color.
Close