0.2.3 • Published 5 years ago

img-color-palette v0.2.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Color Palette

提取颜色主色调,仅支持浏览器 (Extract image main color, only support browser)

例子 | See Demo

安装 (Install)

yarn add img-color-palette

# or

npm install img-color-palette

用法 (Usage)

import getPalette from 'img-color-palette';
const img = document.getElementById('img-id');

const colors = getPalette(img, 8, {
  image: 0.2, // 0.1 - 1
  algorithm: 8, // 1 - 8
});

colors.forEach(color => console.log(color));

说明 (Explain)

function getPalette(
  img: HTMLImageElement, // 需要解析的图片
  length: number, // 返回的颜色的个数
  quality: {
    image: number; // 图片的质量 0.1 最小, 1 最大
    algorithm: number // 算法精度 1 最差, 8 最好,整数
  },
): Color[];
0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3-1

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago