# color-palette-picker

> A flexible color palette picker

Latest version **1.1.3** (published 2019-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install color-palette-picker
pnpm add color-palette-picker
yarn add color-palette-picker
bun add color-palette-picker
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2019-04-13 |
| First published | 2019-04-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 79 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | escX |
| Maintainers | hiyohoo |
| Keywords | palette, color-picker |

## Links

- npm: https://www.npmjs.com/package/color-palette-picker
- Repository: https://github.com/escX/color-palette-picker
- Homepage: https://escx.github.io/color-palette-picker/
- Issues: https://github.com/escX/color-palette-picker/issues
- npm.io page: https://npm.io/package/color-palette-picker

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.1.3 (latest) — 2019-04-13
- 1.1.2 — 2019-04-07
- 1.1.1 — 2019-04-06
- 1.1.0 — 2019-04-06

## README

# color-palette-picker
A flexible color palette picker

[Live demo and usage](https://escx.github.io/color-palette-picker/)

## Install
```shell
npm install color-palette-picker
```

## Usage
```js
// es5 import
import ColorPalettePicker from 'color-palette-picker';

// or by script
<script src="path/to/color-palette-picker.js"></script>
```

```js
// instantiation
const instance = new ColorPalettePicker(options);

// create panel element and bar element of palette
const panel = instance.create('panel');
const bar = instance.create('bar');

// append element to body
document.body.appendChild(panel);
document.body.appendChild(bar);
```

## Options
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| hsl | Object | {h:0, s:100, l:50} | 初始设置的颜色值，当前只支持 `hsl` 色彩模式的值 |
| panelName | String | panel-range | `panel` 元素的类名 |
| panelWidth | Number | 300 | `panel` 元素的宽度 |
| panelHeight | Number | 185 | `panel` 元素的高度 |
| panelPointRadius | Number | 6 | `panel` 元素中选色滑块的半径 |
| barName | String | bar-range | `bar` 元素的类名 |
| barWidth | Number | 200 | `bar` 元素的宽度 |
| barHeight | Number | 20 | `bar` 元素的高度 |
| barHorizontal | Boolean | true | `bar` 元素是否在水平方向上拖动滑块进行选色 |
| colorRange | Function | - | 钩子函数，拖动滑块进行选色时执行，提供一个 `hsl` 对象作为回调参数 |

## Methods
| Name | Params | Description |
| --- | --- | --- |
| create | 'panel' / 'bar' | 生成 `panel` 或者 `bar` 元素 |
| destory | - | 销毁实例以及元素节点 |
| get | - | 获取当前调色板选中的 `hsl` 颜色 |
| set | {h, s, l} | 设置 `hsl` 颜色值 |

---
_Source: https://npm.io/package/color-palette-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
