# Class: oColor

## $. oColor

$.oColor Base Class

#### new $.oColor(oPaletteObject, attributeObject)

openHarmony/openHarmony_color.js, line 391
  The base class for the $.oColor.

  Name | Type | Description
  --- | --- | ---
  `oPaletteObject` | $.oPalette | The palette to which the color belongs.
  `attributeObject` | int | The index of the color in the palette.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `palette` | $.oPalette | The palette to which the color belongs.

### Members

#### colorObjectBaseColor

  The Harmony color object.

#### idstring

  The id of the color.

#### indexint

  The index of the color.

#### namestring

  The name of the color.

#### selectedbool

  Whether the color is selected.

#### typeint

  The type of the color.

#### valueobject

  Takes a string or array of strings for gradients and filename for textures. Instead of passing rgba objects, it accepts "#rrggbbaa" hex strings for convenience.
  set gradients, provide an array of {string color, double position} objects that define a gradient scale.

### Methods

#### copyToPalette(oPaletteObject, index)

openHarmony/openHarmony_color.js, line 597
  Copies the palette to another Palette Object (CFNote: perhaps have it push to paletteObject, instead of being done at the color level)

  Name | Type | Description
  --- | --- | ---
  `oPaletteObject` | $.oPalette | The paletteObject to move this color into.
  `index` | int | Need clarification from mchap

#### hexToRgba(hexString)

openHarmony/openHarmony_color.js, line 644
  Static helper function to convert from hex string in format #FFFFFFFF to {r:int, g:int, b:int, a:int}
  Consider moving this to a helper function.

  Name | Type | Description
  --- | --- | ---
  `hexString` | string | RGB object

#### moveToPalette(oPaletteObject, index)

openHarmony/openHarmony_color.js, line 581
  Moves the palette to another Palette Object (CFNote: perhaps have it push to paletteObject, instead of being done at the color level)

  Name | Type | Description
  --- | --- | ---
  `oPaletteObject` | $.oPalette | The paletteObject to move this color into.
  `index` | int | Need clarification from mchap

#### remove()

openHarmony/openHarmony_color.js, line 613
  Removes the color from the palette it belongs to.

#### rgbaToHex(rgbaObject)

openHarmony/openHarmony_color.js, line 626
  Static helper function to convert from {r:int, g:int, b:int, a:int} to a hex string in format #FFFFFFFF
  Consider moving this to a helper function.

  Name | Type | Description
  --- | --- | ---
  `rgbaObject` | obj | RGB object