# Class: Color

## helma.Color(R, G, B)

Instances of this class provide methods for converting HTML color names into their corresponding RGB values and vice versa, or retrieving single RGB color values.

## Constructor

#### new Color(R, G, B)

Constructs a new instance of helma.Color.

##### Parameters:

Name | Type | Description
--- | --- | ---
`R` | Number | String | Either the red fraction of the color, or the name of the color.
`G` | Number | The green fraction
`B` | Number | The blue fraction

Source:
  - helma/Color.js, line 47

##### Returns:

A newly created helma.Color instance

### Members

#### (static, readonly) COLORNAMES :Object

Contains the hexadecimal values of named colors.

##### Type:

- Object

Source:
  - helma/Color.js, line 232

#### (static, readonly) COLORVALUES :Object

Contains the color names for specific hex values

##### Type:

- Object

Source:
  - helma/Color.js, line 377

### Methods

#### getName()

Returns the trivial name of this color

Source:
  - helma/Color.js, line 103

##### Returns:

The trivial name of this color

#### toString()

Returns the hexidecimal value of this color (without a leading hash sign).

Source:
  - helma/Color.js, line 89

##### Returns:

The hexidecimal value of this color

#### valueOf(channel)

Returns the decimal value of this color, or of a specified color channel.

##### Parameters:

Name | Type | Description
--- | --- | ---
`channel` | String | An optional color channel which decimal value should be returned. Must be either "red", "green" or "blue". If no channel is specified this method returns the decimal value of the color itself.

Source:
  - helma/Color.js, line 63

##### Returns:

The decimal value of this color or a single channel.

#### (static) fromHsl(H, S, L)

Creates a new helma.Color instance based on a HSL color representation. This method is adapted from the HSLtoRGB conversion method as described at http://www1.tip.nl/~t876506/ColorDesign.html#hr.

##### Parameters:

Name | Type | Description
--- | --- | ---
`H` | Number | The hue fraction of the color definition
`S` | Number | The saturation fraction
`L` | Number | The lightness fraction

Source:
  - helma/Color.js, line 166

##### Returns:

An instance of helma.Color representing the corresponding RGB color definition.

#### (static) fromName(name)

Creates a new helma.Color instance based on a color name.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The color name (eg. "darkseagreen")

Source:
  - helma/Color.js, line 148

##### Returns:

An instance of helma.Color representing the color specified