Options
All
  • Public
  • Public/Protected
  • All
Menu

Settings that can be configured for each color picker instance separately.

since

0.15.0

Hierarchy

Index

Properties

alpha?: boolean

Enable or disable alpha support.

When disabled, it will strip the alpha value from the existing color value in all formats.

default

true

clearButton?: boolean | export=.ClearButtonOptions

Whether to show an optional clear button. Use clearLabel to set the label.

Note that this should be a boolean, a ClearButtonOptions object is still supported for backwards compatibility, but it is deprecated.

default

false

clearLabel?: string

Set the label of the clear button.

default

Clear

since

0.17.0

closeButton?: boolean | export=.CloseButtonOptions

Whether to show an optional close button. Use closeLabel to set the label.

Note that this should be a boolean, a CloseButtonOptions object is still supported for backwards compatibility, but it is deprecated.

default

false

closeLabel?: string

Set the label of the close button.

default

Close

since

0.17.0

focusInput?: boolean

Focus the color value input when the color picker dialog is opened.

default

true

forceAlpha?: boolean

Set to true to always include the alpha value in the color value even if the opacity is 100%.

default

false

Sets the preferred color string format. The format affects which value is shown in the input field. See ColorFormat for more details.

default

"hex"

formatToggle?: boolean

Set to true to enable format toggle buttons in the color picker dialog.

This will also force the format to auto.

default

true

margin?: number

The margin in pixels between the input fields and the color picker's dialog.

default

2

A function that is called whenever a new color is picked.

since

0.18.0

parent?: null | string | HTMLElement | HTMLElement[]

CSS selector for the parent.

The default behavior is to append the color picker's dialog to the end of the document's body. but it is possible to append it to a custom parent instead. This is especially useful if the color fields are in a scrollable container and you want color picker' dialog to stay anchored to them. You will need to set the position of the container to relative or absolute. Note: This should be a scrollable container with enough space to display the picker.

default

null

selectInput?: boolean

Select and focus the color value input when the color picker dialog is opened.

default

false

swatches?: string[]

An array of the desired color swatches to display. If omitted or the array is empty, the color swatches will be disabled.

default

[]

swatchesOnly?: boolean

Set to true to hide all the color picker widgets (spectrum, hue, ...) except the swatches.

default

false

theme?: export=.Theme

The color theme to use for the color picker. More themes might be added in the future. Available themes: default, large, polaroid.

default

"default"

themeMode?: export=.ThemeMode

Set the theme to light or dark mode:

  • light: light mode.
  • dark: dark mode.
  • auto: automatically enables dark mode when the user prefers a dark color scheme.
default

"light"

Generated using TypeDoc