# Color

Source:
  - graphics/color.js, line 3

### Methods

#### (static) average(colorOne, colorTwo) → {string}

Generate the average of two hex colors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`colorOne` | string | First hex color.
`colorTwo` | string | Second hex color.

Source:
  - graphics/color.js, line 238

##### Returns:

Averaged hex color.

Type
  string

#### (static) createFromRGB(r, g, b) → {string}

Create a hex color from RGB values.

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | number | Red value.
`g` | number | Green value.
`b` | number | Blue value .

Source:
  - graphics/color.js, line 93

##### Returns:

Type
  string

#### (static) createFromRGBL(r, g, b, l) → {string}

Creates a hex color string from a (r,g,b) value as well as a lightness value l from [0, 1]. To do this we convert the rgb color to hsl. Then we modify the l, take it back to rgb, and then convert to a color string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | number | The red color value.
`g` | number | The green color value.
`b` | number | The blue color value.
`l` | number | The lightness value [0,1].

Source:
  - graphics/color.js, line 137

##### Returns:

The hex color string.

Type
  string

#### (static) hslToRgb(h, s, l) → {object}

Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].

##### Parameters:

Name | Type | Description
--- | --- | ---
`h` | number | The hue.
`s` | number | The saturation.
`l` | number | The lightness.

Source:
  - graphics/color.js, line 216

##### Returns:

The RGB representation.

Type
  object

#### (static) hue2rgb(p, q, t) → {number}

Converts an HSL representation to RGB.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p` | number |
`q` | number |
`t` | number |

Source:
  - graphics/color.js, line 196

##### Returns:

RGB representation of component.

Type
  number

#### (static) randomBlue() → {string}

Generate a random blue value.

Source:
  - graphics/color.js, line 119

##### Returns:

Hex representation of random blue color.

Type
  string

#### (static) randomGreen() → {string}

Generate a random green value.

Source:
  - graphics/color.js, line 110

##### Returns:

Hex representation of random green color.

Type
  string

#### (static) randomRed() → {string}

Generate a random red value.

Source:
  - graphics/color.js, line 101

##### Returns:

Hex representation of random red color.

Type
  string

#### (static) rgbToHex(r, g, b) → {string}

Convert RGB to a hex string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | number | Red component.
`g` | number | Green component.
`b` | number | Blue component.

Source:
  - graphics/color.js, line 73

##### Returns:

Hex representation.

Type
  string

#### (static) rgbToHsl(r, g, b) → {array}

Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | number | The red color value.
`g` | number | The green color value.
`b` | number | The blue color value.

Source:
  - graphics/color.js, line 163

##### Returns:

The HSL representation.

Type
  array

#### (static) toString() → {string}

Generate a hex representation of the color.

Source:
  - graphics/color.js, line 25

##### Returns:

Type
  string