colorstops

0.1.0 • Public • Published

colorstops

Mix colors against multiple color stops.

Installation

ES6 Module

import ColorStops from 'colorstops';

Browserify

$ browserify colorstops.js --standalone ColorStops -o colorstops-browser.js

Usage

Constructor

let colorStops = new ColorStops([
   { color: '#FF0000', value: 20 },
   { color: '#00FF00', value: 40 },
   { color: '#0000FF', value: 80 }
]);

hex

Get a mixed hex color string for an input value against the defined color stops.

colorStops.hex(-200); // '#FF0000'
colorStops.hex(20);   // '#FF0000'
colorStops.hex(30);   // '#808000'
colorStops.hex(40);   // '#00FF00'
colorStops.hex(41);   // '#00F906'
colorStops.hex(79);   // '#0006F9'
colorStops.hex(200);  // '#0000FF'

Tests

$ npm run test

License

This software is released under the terms of the MIT license. See LICENSE.

Readme

Keywords

Package Sidebar

Install

npm i colorstops

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

6.81 kB

Total Files

5

Last publish

Collaborators

  • gavinhungry