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 181

Extends

Classes

Error

Members

<static, readonly> alpha :Number

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

<static, readonly> b :Number

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

<static, readonly> g :Number

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

<static, readonly> glArray :Float32Array

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

<static, readonly> r :Number

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

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 256
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 228
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 239
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 273
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 323
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 290
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 341
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 379
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 360
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 307
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 204
Returns:
Reference to this object for method chaining
Type
me.Color

<static> toHex() → {String}

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

<static> toHex8() → {String}

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

<static> toRGB() → {String}

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

<static> toRGBA() → {String}

Get the color in "rgba(R,G,B,A)" format
Source:
color.js, line 489
Returns:
Type
String
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:40+08:00 using the DocStrap template modified by codename-.