Home

Class goog.ui.ColorPicker

Create a new, empty color picker.

extends goog.ui.Component
Instance Method Summary
addColors(?Array colors)

Sets the array of colors to be displayed by the color picker.

canDecorate(?Element element) ⇒ boolean

ColorPickers cannot be used to decorate pre-existing html, since the structure they build is fairly complicated.

createColorPalette_(?Array colors)

Create a color palette for the color picker.

disposeInternal()

Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.

enterDocument()

Renders the color picker inside the provided element. This will override the current content of the element.

focus()

Sets the focus to the color picker's palette.

getColors() ⇒ ?Array

Gets the array of colors displayed by the color picker. Modifying this array will lead to unexpected behavior.

getSelectedColor() ⇒ ?string

Gets the color that is currently selected in this color picker.

getSelectedIndex() ⇒ number
getSize() ⇒ ?goog.math.Size

Gets the number of columns displayed.

isFocusable() ⇒ boolean

Returns true if the component is focusable, false otherwise. The default is true. Focusable components always have a tab index and allocate a key handler to handle keyboard events while focused.

onColorPaletteAction_(?goog.events.Event e)

Handles actions from the color palette.

setColors(?Array colors)

Sets the array of colors to be displayed by the color picker.

setColumnCount(number n)

Sets the number of columns. Will throw an error after the picker has been rendered.

setFocusable(boolean focusable)

Sets whether the component is focusable. The default is true. Focusable components always have a tab index and allocate a key handler to handle keyboard events while focused.

setSelectedColor(string color)

Sets which color is selected. Noop if the color palette hasn't been created yet.

setSelectedIndex(number ind)

Sets which color is selected. A value that is out-of-range means that no color is selected.

setSize((goog.math.Size|null|number) size)

Sets the size of the palette. Will throw an error after the picker has been rendered.

Static Method Summary
createSimpleColorGrid(?goog.dom.DomHelper= opt_domHelper) ⇒ ?goog.ui.ColorPicker

Returns an unrendered instance of the color picker. The colors and layout are a simple color grid, the same as the old Gmail color picker.