0.1.2 • Published 1 year ago

@liquid-js/palette v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Palette

GitHub license npm scope

Get colour palette from an image.

Installation

npm install @liquid-js/palette

API Documentation

https://liquid-js.github.io/palette/

Usage

To obtain colours from an image, use extractImageData and quantize (note: quantize might take a long time to run depending on image size; consider running it asynchronously).

import { extractImageData, quantize } from '@liquid-js/palette'

const imageUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Peace_Of_Nature_%28129019177%29.jpeg/640px-Peace_Of_Nature_%28129019177%29.jpeg'

const img = new Image()
img.crossOrigin = 'anonymous'
img.addEventListener('load', () => {
    const imageData = extractImageData(img)
    const colors = quantize(imageData)

    console.log(colors)
})
img.src = imageUrl

License

MIT License

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.2

5 years ago