@tanbo/color-picker
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

颜色选择器

安装

npm install @tanbo/color-picker

使用

import { createPicker } from '@tanbo/color-picker';

const picker = createPicker(document.getElementById('picker'));

// 当用户确认选中颜色后触发
picker.onSelected.subscribe(() => {
  console.log(picker.rgb)
})

// 当用户选择颜色时触发
picker.onChange.subscribe(() => {
  console.log(picker.rgb)
})

// 设置选择器的颜色,你还可以设置其它格式,如 rgba、hex、hsl 等
picker.rgb = {
  r: 255,
  g: 255,
  b: 255
};

Readme

Keywords

none

Package Sidebar

Install

npm i @tanbo/color-picker

Weekly Downloads

24

Version

1.0.3

License

ISC

Unpacked Size

81.6 kB

Total Files

14

Last publish

Collaborators

  • tanbo