Class: Color

ol.ext.input. Color

Color picker


new Color(options)

Parameters:
Name Type Description
options *
Properties
Name Type Argument Default Description
className string <optional>
color ol.colorLike <optional>

default color

input Element <optional>

input element, if non create one

parent Element <optional>

parent element, if create an input

hastab boolean <optional>
false

use tabs for palette / picker

paletteLabel string <optional>
"palette"

label for the palette tab

pickerLabel string <optional>
"picker"

label for the picker tab

position string <optional>
'popup'

fixed | static | popup | inline (no popup)

opacity boolean <optional>
true

enable opacity

autoClose boolean <optional>
true

close when click on color

hidden boolean <optional>
true

display the input

Fires:
  • event:color

Extends

Methods


addPaletteColor(color, title, select)

Add color to palette

Parameters:
Name Type Description
color ol.colorLike
title string
select boolean

collapse( [b])

show/hide color picker

Parameters:
Name Type Argument Default Description
b boolean <optional>
false
Inherited From:
Overrides:

getColor( [opacity])

Get current color

Parameters:
Name Type Argument Default Description
opacity boolean <optional>
true
Returns:
Type
Array.<number>

getColorFromID(id)

Convert color to id

Parameters:
Name Type Description
id number
Returns:

Color

Type
Array.<number>

getColorID(Color)

Convert color to id

Parameters:
Name Type Description
Color ol.colorLike
Returns:
Type
number

getInputElement()

Get the input element

Inherited From:
Overrides:
Returns:
Type
Element

getTab()

Show palette or picker tab

Returns:

palette or picker

Type
string

getValue()

Get the current getValue

Inherited From:
Overrides:
Returns:
Type
string

isCollapsed()

Is the popup collapsed ?

Inherited From:
Overrides:
Returns:
Type
boolean

setColor(color)

Set Color

Parameters:
Name Type Description
color Array.<number>

setValue()

Set the current value

Inherited From:
Overrides:

showTab(what)

Show palette or picker tab

Parameters:
Name Type Description
what string

palette or picker


toggle()

Toggle the popup

Inherited From:
Overrides: