Skip to content

Input ​

ewColorPickerInput renders a text field accepting hex / rgb(a) / hsl(a). Valid input applies immediately; invalid input never pollutes the current color.

ItemValue
Package@ew-color-picker/input
pluginNameewColorPickerInput
applyOrderPost
Mount pointpanelContainer
Instancecore.plugins.ewColorPickerInput

Options ​

OptionTypeDefaultDescription
hasInputbooleantrueHide the field
disabledbooleanfalseDisable it
changeColor(rgba: string) => void—Applied color callback

Display format follows the current mode: hex in Hex mode, rgb()/rgba() in RGB, hsl()/hsla() in HSL.

Methods ​

Method / propertySignatureDescription
enableInput(enable = true) => voidShow/hide
hasInputboolean getter/setterRe-renders on change
setValue(value: string) => voidSet text only
getValue() => stringRead text
setDisabled(disabled: boolean) => voidToggle disabled state
update(color: string) => voidFormat and write current color
onInputColor(value: string) => voidInput handler (300ms debounce)
inputHTMLInputElement | nullDOM

Validation ​

InputResult
#f00, #ff0000, #ff000080Valid
rgb(255,0,0), rgba(255,0,0,0.5)Valid
hsl(0,100%,50%), hsla(...)Valid
''Valid (clears color)
otherInvalid, ignored (may warn)

Input is debounced by 300ms.

Events ​

ts
core.setColor(rgbaColor)
core.trigger('change', rgbaColor)
options.changeColor?.(rgbaColor)

DOM ​

html
<div class="ew-color-picker-input-container ew-color-picker-input-container-flex">
  <input class="ew-color-picker-input" type="text" />
</div>

Disabled adds ew-input-disabled.

Example ​

ts
const picker = new ewColorPicker({
  el: '#app',
  defaultColor: '#0ea5e9',
  hasInput: true,
  changeColor: (rgba) => console.log(rgba),
})