Changelog
2.0.9
Fixes
- Fixed the vertical hue slider being out of sync with the colour panel: the stylesheet gradient increases hue from top to bottom (
linear-gradient(180deg, ...)), but the thumb position and click/drag mapping used the inverted1 - hue / 360formula. The thumb now sits on the matching colour, and clicking or dragging picks the hue you actually see - Fixed the alpha slider having no colour: the background layer only showed the transparency checkerboard, so the alpha track gave no visual feedback. It now renders a gradient from the fully opaque current colour to transparent, following the horizontal or vertical direction, and updates whenever the colour changes
- Fixed the console banner printing a stale version (
2.0.7). The version is now injected frompackage.jsonat build time, so it can no longer drift from the published release
Tests
- Added regression tests for the vertical hue thumb position and click mapping, the alpha gradient direction in both orientations, and the console banner version
2.0.8
Fixes
- Fixed arrow and close icon positioning for users who load the static CSS via
<link>: the icon rules were only injected at runtime by the core entry, so the SCSS build (@ew-color-picker/style) was missing them and the arrow rendered off-center. The rules are now in the SCSS source as well - Arrow icon
fillchanged from hard-coded#666666tocurrentColor, so icons inherit the theme text color - Fixed the empty root container taking up
line-heightheight whenhasBox: falseis used together withappendTo: the.ew-color-pickershell is now hidden via:empty { display: none }and reappears automatically once the box is rendered - Fixed panel positioning when
hasBox: false: the panel anchor now falls back from the box to the user-suppliedelcontainer (and only then to the root element), so the panel is no longer positioned against a 0-size empty shell - Fixed
showPanel/hidePanelnot being idempotent: callingshowPanelwhile the panel was already open re-ran the open animation, which briefly reset the panel height to0and made it look like the panel closed. Both methods now return early when the panel is already in the target state
Docs
- Added npm version, downloads, license, build, TypeScript and stars badges to both READMEs
- Added a live demo screenshot to both READMEs
2.0.7
Fixes
- Fixed the picker panel being covered by overlay masks in Element Plus Dialog and similar layered containers: the panel
z-indexwas fixed at1000in the stylesheet while overlay libraries start at2000and increase on every open. The panel now raises its inlinez-indexto one above the highest ancestor level each time it opens, leaves normal pages to the stylesheet default, and falls back silently if reading or writing styles fails
Tests
- Added regression tests for automatic
z-indexelevation inside layered containers, recomputation on repeated opens, and the untouched inline style on normal pages
2.0.6
Fixes
- Fixed
colorRgbaToHsvaturning a valid alpha of0into1(parseFloat(...) || 1treated0as falsy), which made fully transparent colors opaque once hue or saturation/value was adjusted and madegetHsvaColor()returna: 1 - Fixed
colorRgbaToHslareturningcolorObj.hon the internal0-6scale instead of degrees, which broke the round trip throughcolorHslaToRgba(e.g. greenrgba(0, 202, 136, 1)came back asrgba(204, 10, 0, 1))
Tests
- Added regression tests for the
rgba(..., 0)round trip, the unparseable-alpha fallback and the HSL hue / round trip
Release
- Added a GitHub Actions CI workflow running dependency install, the full test suite and a full package build on pushes and pull requests to
master - Declared
rimrafas a dev dependency ofutilsandcoreso clean builds work under pnpm's strictnode_moduleslayout
2.0.5
Fixes
- Fixed panel positioning inside drawers, modals and scroll containers: new
boundaryoption accepts a CSS selector or HTMLElement, clamping the panel within that container's visible area instead of only the viewport - Fixed
document.mousedownlistener leaking afterdestroy()when the panel show timer fired after destruction; the callback now bails out if the instance is already destroyed - Fixed root
build:xxxshortcuts silently doing nothing (pnpm -r build:xxxmatched no package scripts); replaced withpnpm --filter <pkg> buildand added missing shortcuts for gradient, select, checkbox, copy-color and input-number
Refactor
- Consolidated drag logic into
utils/drag.ts: newgetRatio,bindMouseDragandbindTouchDragutilities, reused by hue, alpha, panel and gradient; eliminates ~10as EventListenercasts - Extracted
DEFAULT_PANEL_WIDTH/DEFAULT_PANEL_HEIGHTconstants, replacing 7 hard-coded285 / 180occurrences across panel and gradient - Unified on utility functions:
isString/isObject/isBoolean/isNumberreplace rawtypeofchecks;$andgetRectreplace directquerySelector/getBoundingClientRectcalls - Removed
as anycasts in plugin options initialization;install(core: any)aligned toinstall(core: ewColorPicker)across all plugins getPrefixnow usesisStringand acceptsewColorPickerinstance type instead ofany- Removed unused
eventTypedead code from utils - Documented the implicit
applyOrdersorting convention: plugins withoutapplyOrderdefault to 0 and run before allPostplugins
Docs
- Added
boundaryoption documentation (English and Chinese) with usage examples - Added example page
18-panel-boundary.htmldemonstrating container-bound panel positioning - Fixed docs site footer friend links showing Chinese text on the English version
- Added missing example navigation links (15-18) to the examples index
Release
- Added
prepublishOnly: "npm run build"to all packages so dist is rebuilt before every publish
2.0.4
Features
- New
@ew-color-picker/selectcomponent and plugin: custom option lists with placeholder, sizes, keyboard navigation, click-outside closing and ARIA support, an optional clear icon viaselectClearable, andselectItems/selectValue/selectPlaceholder/onSelectChange/onSelectClearoptions. Renders only whenselectItemsis non-empty - New
@ew-color-picker/gradientplugin: a gradient editor with draggable stops, linear/radial/conic types, repeating gradients, angle and position controls, double-position stops, and interpolation hints (srgb,srgb-linear,hsl,oklab,oklch). CSS strings round-trip throughparseGradient/serializeGradient, and the editor is hidden unlessshowGradient: trueorgradient/gradientStopsis provided - New
@ew-color-picker/checkboxcomponent and plugin: replaces the native checkbox visual with a themed box while keeping the underlying native input for semantics and keyboard support. The plugin renders in the bottom row whencheckboxLabelis provided and supportsshowCheckbox/checkboxChecked/checkboxDisabled/onCheckboxChange - The aggregate package now exports a
createEwColorPicker(options)factory, and theew-color-pickercompat entry exposes the same factory
Fixes
- Fixed
defaultColorhandling: instance plugins are not created yet at that point, so the check now reads the static plugin registry to see whether the alpha plugin is registered; without alpha, an rgba default correctly falls back to hex - Fixed the hue bar background, panel cursor and hue / alpha thumb positions being wrong when the panel opens without an initial color (or with a color set later): everything is re-synced against the current color once the panel is shown
- Fixed the panel width calculation for different hue / alpha direction combinations, which pushed same-row elements onto a new line and misaligned the edges
- Fixed
colorRgbaToHsvaonly accepting rgba strings; it now also handles hex / rgb / color keywords - Fixed the gradient editor stop-row layout: number inputs clipped their values and the Remove / Add buttons were pushed onto a new line; inputs are now wider with compact steppers and tighter gaps so everything fits on one row
2.0.3
This release has been published to npm and the docs site has been updated.
Features
- New
@ew-color-picker/eyedropperplugin: sample colors from anywhere on screen through the native EyeDropper API. It detects browser support, writes the result withcore.setColor(), supportsshowEyedropper/eyedropperText/onEyedropperPick, and silently ignoresAbortErrorwhen the user cancels - New
@ew-color-picker/copy-colorplugin: copy the current color to the clipboard with one click. The button is filled with the current color and uses contrast-aware icons, prefers the async Clipboard API with aexecCommandfallback, shows a short built-in success toast, and supportsshowCopyColor/copyColorText/copiedText/onCopyColor - The eyedropper and copy buttons now live in their own toolbar row above the color value input, instead of sharing the row with the Clear / Sure buttons
Fixes
- Fixed the InputNumber stepper arrows: they now carry the correct icon class and render at 10px, staying centered inside the button instead of overflowing and being clipped by the divider
- Fixed RGB / HSL channel inputs resetting to
0on the first stepper click; internal values are now synced with the current color so increment/decrement starts from the current channel value
2.0.2
Fixes
- Published package manifests now reference the matching release version (
^2.0.2) for internal dependencies instead of the stale^2.0.0range. This prevents mixed installs where a 2.0.1 plugin resolved an older@ew-color-picker/utilsthat did not exportgetPrefix
2.0.1
These changes have been published to npm and are reflected in the docs site.
Fixes
- Fixed plugin switches being overridden:
ewColorPickerPanel: falseandewColorPickerColorMode: false(or an object config) were replaced by defaults and did not take effect - Panel container now declares
box-sizing: content-box, no longer relying on the host globalbox-sizingreset - Removed viewport media queries (
max-width: 768px) that hard-coded panel, input and preset sizes; inner sizes are now driven solely by--panel-width/--panel-height - Predefined swatches now use flex wrapping; removed the hard-coded "10 per row" rule that caused wrong wrapping when the swatch count or container width changed
use()now deduplicates bypluginName, preventing duplicate registration under HMR, repeated imports or multiple entry points- Plugin constructor errors are now reported through
console.warnwith the plugin name and error details instead of being silently swallowed, making custom plugin debugging easier
Features
- New
appendTooption: mount the panel container intodocument.bodyor any container to avoidoverflowclipping by dialogs, drawers and scroll containers. The panel then uses viewport-relative positioning, still honorspanelPlacementwith boundary flipping, and re-positions on scroll or resize - New
prefixoption: customize the prefix of every CSS class name (defaultew-) to avoid style collisions when embedding the picker in another library. The SCSS build exposes a matching$prefixvariable that must stay in sync with the JS option ApplyOrderchanged fromconst enumto a regular enum, so it can be imported at runtime from@ew-color-picker/utilswithout hand-writing'pre'/'post'strings
Documentation
- Corrected predefined swatch and number input class names to match the source
- Removed the non-existent nested
ewColorPickerBoxconfig in favor of top-level options - Corrected the prerequisites of
autoPanelPosition - Added
appendTodocumentation (Chinese and English) - Added
prefixdocumentation (Chinese and English) with a custom SCSS build example - Added
applyOrderexecution-order documentation and examples (Chinese and English) - The docs site now defaults to English; Chinese docs moved under
/zh/, and the README defaults to English
2.0.0
First stable release: core + plugin architecture, 14 packages (13 scoped packages plus the unscoped ew-color-picker entry package), bilingual docs site and live demo.