Skip to content

Hue ​

ewColorPickerHue renders the 0–360° hue slider while keeping saturation, value and alpha unchanged.

ItemValue
Package@ew-color-picker/hue
pluginNameewColorPickerHue
applyOrderPost
Mount pointpanelContainer
Instancecore.plugins.ewColorPickerHue

Options ​

OptionTypeDefaultDescription
huebooleantruefalse hides the slider at construction
hueDirection'horizontal' | 'vertical''vertical'Orientation
disabledbooleanfalseBlocks interaction

Methods ​

Method / propertySignatureDescription
enableHue(enable = true) => voidShow/hide
updateHue(hue: number) => voidApply hue (0–360) via setColor()
updateHueThumbPosition(hue: number) => voidMove thumb only
hasHueboolean getter/setterRe-renders on change
hueBar / hueThumbHTMLElement | nullDOM
isHorizontalbooleanOrientation flag

Behaviour ​

ActionResult
ClickHue computed from position, color applies
DragThrottled 16ms
External changeThumb syncs to the new hue

The gradient always shows the full spectrum.

Events ​

Changes go through core.setColor(), so:

ts
picker.on('change', (color) => console.log(color))

DOM ​

html
<div class="ew-color-picker-slider ew-color-picker-is-vertical">
  <div class="ew-color-picker-slider-bar"></div>
  <div class="ew-color-picker-slider-thumb"></div>
</div>

Example ​

ts
const picker = new ewColorPicker({
  el: '#app',
  defaultColor: '#ef4444',
  hueDirection: 'horizontal',
})

picker.on('change', () => console.log(picker.hsvaColor.h))
picker.plugins.ewColorPickerHue.updateHue(200)