# inputEx-library

### inputEx 0.5.1

inputEx-library > inputEx > inputEx.ColorField
Search:
Filters Show Private Show Protected Show Deprecated

## Class inputEx.ColorField - extends inputEx.Field

Create a Color picker input field

### Constructor

inputEx.ColorField `( options )`

Parameters:
  `options <Object>` Added options for ColorField :
  - colors: list of colors to load as palette
  - palette: default palette to be used (if colors option not provided)
  - cellPerLine: how many colored cells in a row on the palette
  - ratio: screen-like ratio to display the palette, syntax: [with,height], default: [16,9] (if cellPerLine not provided)

### Properties

#### palettes - `object`

Default palettes

#### Properties inherited from inputEx.Field:

`options`

### Methods

#### close

`void close ( )`
Call overlay when field is removed

#### destroy

`void destroy ( )`
Purge all event listeners and remove the component from the dom

#### getValue

`String getValue ( )`
Return the color value

Returns: `String`
  Color value

#### onColorClick

`void onColorClick ( e )`
Handle a color selection

Parameters:
  `e <Event>` The original click event

#### renderColorGrid

`void renderColorGrid ( )`
This creates a color grid

#### renderComponent

`void renderComponent ( )`
Render the color button and the colorpicker popup

#### setDefaultColors

`Array setDefaultColors ( index )`
Set the colors to set in the picker

Parameters:
  `index <int>` Index of the palette to use

Returns: `Array`
  List of colors to choose from

#### setOptions

`void setOptions ( options )`
Adds the 'inputEx-ColorField' default className

Parameters:
  `options <Object>` Options object as passed to the constructor

#### setValue

`void setValue ( value , [sendUpdatedEvt] )`
Set the value

Parameters:
  `value <String>` Color to set
  `[sendUpdatedEvt] <boolean>` (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)

#### Methods inherited from inputEx.Field:

`clear, close, destroy, disable, displayMessage, enable, fireUpdatedEvt, focus, getEl, getParentField, getState, getStateString, getValue, hide, initEvents, isDisabled, isEmpty, onBlur, onChange, onFocus, render, renderComponent, setClassFromState, setFieldName, setOptions, setParentField, setValue, show, validate`

#### Events inherited from inputEx.Field:

`updatedEvt,`

Copyright © 2010 Eric Abouaf All rights reserved.