Class: Color

me. Color

new Color(r, g, b, alpha)

A color manipulation object.
Parameters:
Name Type Argument Default Description
r Float32Array | Number <optional>
0 red component or array of color components
g Number <optional>
0 green component
b Number <optional>
0 blue component
alpha Number <optional>
1.0 alpha value
Source:
color.js, line 187

Extends

Classes

Error

Members

<static, readonly> alpha :Number

Color Alpha Component
Type:
  • Number
Source:
color.js, line 575

<static, readonly> b :Number

Color Blue Component
Type:
  • Number
Source:
color.js, line 555

<static, readonly> g :Number

Color Green Component
Type:
  • Number
Source:
color.js, line 535

<static, readonly> glArray :Float32Array

Color components in a Float32Array suitable for WebGL
Type:
  • Float32Array
Source:
color.js, line 196

<static, readonly> r :Number

Color Red Component
Type:
  • Number
Source:
color.js, line 515

Methods

<static> add(color) → {me.Color}

Blend this color with the given one using addition.
Parameters:
Name Type Description
color me.Color
Source:
color.js, line 262
Returns:
Reference to this object for method chaining
Type
me.Color

<static> clone() → {me.Color}

Create a new copy of this color object.
Source:
color.js, line 234
Returns:
Reference to the newly cloned object
Type
me.Color

<static> copy(color) → {me.Color}

Copy a color object or CSS color into this one.
Parameters:
Name Type Description
color me.Color | String
Source:
color.js, line 245
Returns:
Reference to this object for method chaining
Type
me.Color

<static> darken(scale) → {me.Color}

Darken this color value by 0..1
Parameters:
Name Type Description
scale Number
Source:
color.js, line 279
Returns:
Reference to this object for method chaining
Type
me.Color

<static> equals(color) → {Boolean}

Return true if the r,g,b,a values of this color are equal with the given one.
Parameters:
Name Type Description
color me.Color
Source:
color.js, line 329
Returns:
Type
Boolean

<static> lighten(scale) → {me.Color}

Lighten this color value by 0..1
Parameters:
Name Type Description
scale Number
Source:
color.js, line 296
Returns:
Reference to this object for method chaining
Type
me.Color

<static> parseCSS(color) → {me.Color}

Parse a CSS color string and set this color to the corresponding r,g,b values
Parameters:
Name Type Description
color String
Source:
color.js, line 347
Returns:
Reference to this object for method chaining
Type
me.Color

<static> parseHex(color) → {me.Color}

Parse a Hex color ("#RGB", "#RGBA" or "#RRGGBB", "#RRGGBBAA" format) and set this color to the corresponding r,g,b,a values
Parameters:
Name Type Description
color String
Source:
color.js, line 385
Returns:
Reference to this object for method chaining
Type
me.Color

<static> parseRGB(color) → {me.Color}

Parse an RGB or RGBA CSS color string
Parameters:
Name Type Description
color String
Source:
color.js, line 366
Returns:
Reference to this object for method chaining
Type
me.Color

<static> random() → {me.Color}

Generate random r,g,b values for this color object
Source:
color.js, line 313
Returns:
Reference to this object for method chaining
Type
me.Color

<static> setColor(r, g, b, alpha) → {me.Color}

Set this color to the specified value.
Parameters:
Name Type Argument Default Description
r Number red component [0 .. 255]
g Number green component [0 .. 255]
b Number blue component [0 .. 255]
alpha Number <optional>
1.0 alpha value [0.0 .. 1.0]
Source:
color.js, line 210
Returns:
Reference to this object for method chaining
Type
me.Color

<static> toHex() → {String}

Get the color in "#RRGGBB" format
Source:
color.js, line 449
Returns:
Type
String

<static> toHex8() → {String}

Get the color in "#RRGGBBAA" format
Source:
color.js, line 463
Returns:
Type
String

<static> toRGB() → {String}

Get the color in "rgb(R,G,B)" format
Source:
color.js, line 477
Returns:
Type
String

<static> toRGBA() → {String}

Get the color in "rgba(R,G,B,A)" format
Source:
color.js, line 495
Returns:
Type
String