JSPM

  • Created
  • Published
  • Downloads 1086
  • Score
    100M100P100Q88336F
  • License MIT

Given an image, extract predominant & palette colors

Package Exports

  • splashy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (splashy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

splashy

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status Donate

Given an image, extract predominant & palette colors.

Install

$ npm install splashy --save

Usage

From URL

(async () => {
  const splashy = require('splashy')
  const got = require('got')

  const url = 'https://kikobeats.com/images/avatar.jpg'
  const { body } = await got(url, { encoding: null })
  const palette = await splashy(body)

  console.log(palette)
  // => [ '#941c1c', '#841c16', '#aa695e', '#ca866c', '#6c5444', '#cca4a4' ]
})()

From Buffer

(async () => {
  const splashy = require('splashy')
  const path = require('path')
  const fs = require('fs')

  const filepath = path.resolve(__dirname, 'avatar.jpg')
  const buffer = await fs.readFile(filepath)
  const palette = await splashy(buffer)

  console.log(palette)
  // => [ '#941c1c', '#841c16', '#aa695e', '#ca866c', '#6c5444', '#cca4a4' ]
})()

API

splashy(input)

input

Required
Type: ImageSource

The raw contnet for detecting the color information.

License

MIT © Kiko Beats.