modern-palette
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

modern-palette

Minzip Version Downloads Issues License

📦 Install

npm i modern-palette

🦄 Usage

import { Palette } from 'modern-palette'

const palette = new Palette({
  maxColors: 256,
  // (string | number[] | number[][] | CanvasImageSource | BufferSource)[]
  samples: [document.querySelector('img'), [[255, 0, 0], [255, 0, 0]]],
})

palette.addSample('/example.png')

// Generate palette colors data
palette.generate().then(colors => {
  console.log(colors)

  // Find the nearest color on the palette
  const nearestColor = palette.match('#ffffff')
  // palette.match([255, 255, 255])

  console.log(nearestColor)
})

Options

See the options.ts

Palette

See the Palette.ts

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.0950latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.0950
0.2.4734
0.2.30
0.2.20
0.2.10
0.2.00
0.1.80
0.1.70
0.1.60
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i modern-palette

Weekly Downloads

1,359

Version

2.0.0

License

MIT

Unpacked Size

57.4 kB

Total Files

16

Last publish

Collaborators

  • wengxiangmin