2.0.0 • Published 4 months ago

modern-palette v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

📦 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

2.0.0

4 months ago

0.2.4

12 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago