Skip to content

ew-color-picker事件驱动 · 插件化颜色选择器

体积小、可组合、可扩展。核心只管颜色与事件,界面交给插件自由拼装。

ew-color-picker

立即体验

下面是一个真实运行的颜色选择器,由本站直接加载构建产物渲染。

最小示例

一个容器、一份样式、一行初始化,即可获得完整的取色体验。

html
<link rel="stylesheet" href="@ew-color-picker/style/dist/index.css" />
<link rel="stylesheet" href="@ew-color-picker/style/dist/input-number.css" />

<div id="picker"></div>

<script type="module">
  import ewColorPicker from '@ew-color-picker/ew-color-picker'

  const picker = new ewColorPicker({
    el: '#picker',
    defaultColor: '#6366f1',
    predefineColor: ['#6366f1', '#8b5cf6', '#06b6d4', '#22c55e'],
    changeColor(color) {
      console.log('当前颜色:', color)
    }
  })
</script>