Skip to content

Given any image (GIF, PNG, WebP, AVIF, etc) extract predominant & palette colors.

License

Notifications You must be signed in to change notification settings

microlinkhq/splashy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

df94195 · Apr 12, 2025
Apr 12, 2025
Jan 16, 2025
Dec 20, 2024
Dec 16, 2024
Dec 18, 2024
Jan 16, 2025
Aug 11, 2017
Aug 11, 2017
Dec 16, 2024
Aug 11, 2017
Aug 11, 2017
Apr 12, 2025
Jan 2, 2020
Dec 16, 2024
Apr 12, 2025
Jan 16, 2025

Repository files navigation

microlink logo microlink logo

Last version Coverage Status NPM Status

Given an image, extract predominant & palette colors. 20+ image formats well tested.

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, { responseType: 'buffer' })
  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 content for detecting the color information.

Related

License

microlink-function © Microlink, released under the MIT License.

Authored and maintained by Kiko Beats with help from contributors.

Special thanks to Tim Carry for writing the benchmark and Lokesh Dhakar for the original code implementation.

microlink.io · GitHub microlinkhq · X @microlinkhq