coex

1.0.0 • Public • Published

coex

Introduction

coex is a library that helps you extract the most common colors of an image in the browser.

Features

  • Usage of the median-cut algorithm.
  • Find contrast colors.
  • AMD compatible

Installing

$ npm install coex

Usage

import Coex from 'coex';

const coex = new Coex(path/to/image);
coex.get(function (err, colors) {
    if (err) {
        throw err;
    }
    console.log(colors);
    const contrastColor = coex.getContrastColor(colors);
    console.log(contrastColor);
    coex.destroy();
});

API

.get(callback)

.getContrastColor(colors, mainColor)

.destroy()

Works on

All browsers that supports HTML5.

License

Released under the MIT License.

Dependents (0)

Package Sidebar

Install

npm i coex

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • marcelombc