Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/microlinkhq/splashy

Given any image (GIF, PNG, WebP, AVIF, etc) extract predominant & palette colors.
https://github.com/microlinkhq/splashy

api color color-scheme dominant-colors microservice palette

Last synced: about 6 hours ago
JSON representation

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

Awesome Lists containing this project

README

        


microlink logo
microlink logo




![Last version](https://img.shields.io/github/tag/microlinkhq/splashy.svg?style=flat-square)
[![Coverage Status](https://img.shields.io/coveralls/microlinkhq/splashy.svg?style=flat-square)](https://coveralls.io/github/microlinkhq/splashy)
[![NPM Status](https://img.shields.io/npm/dm/splashy.svg?style=flat-square)](https://www.npmjs.org/package/splashy)

> Given an image, extract predominant & palette colors. [20+ image formats well tested](https://github.com/microlinkhq/splashy/tree/master/test/fixtures).

## Install

```bash
$ npm install splashy --save
```

## Usage

### From URL

```js
(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

```js
(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](https://github.com/akfish/node-vibrant#imagesource)

The raw content for detecting the color information.

## Related

- [color-microservice](https://github.com/Kikobeats/color-microservice) – Get color information from any URL image microservice.
- [colorable-dominant](https://github.com/Kikobeats/colorable-dominant) – Create ARIA-compliant color themes based on a predominant color palette.

## License

**microlink-function** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlink/microlink-function/blob/master/LICENSE.md) License.

Authored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlink/microlink-function/contributors).

> [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)