Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/microlinkhq/splashy
- Owner: microlinkhq
- License: mit
- Created: 2017-08-11T18:43:04.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T19:36:49.000Z (26 days ago)
- Last Synced: 2024-10-08T20:54:46.967Z (26 days ago)
- Topics: api, color, color-scheme, dominant-colors, microservice, palette
- Language: JavaScript
- Homepage:
- Size: 415 KB
- Stars: 102
- Watchers: 3
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list-microservice - splashy
README
![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)