🧩
插件化架构
Core 仅维护颜色状态与事件总线,Box、Panel、Input、Button 等全部以插件按需注册,可自由裁剪与扩展。
下面是一个真实运行的颜色选择器,由本站直接加载构建产物渲染。
一个容器、一份样式、一行初始化,即可获得完整的取色体验。
<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>