0.0.8 • Published 5 years ago

color-sequences v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

color-seq

generate colors sequence in css accepted format (rgb or hex string), according to input values.

install

npm install color-sequences

Usages

import colorSeq from 'color-sequences';

// data should be an array of object, with keys 'label' and 'value'
const data = [
  { label: 'John Wick', value: 100 },
  { label: 'Tony Stark', value: 18000 },
  ...
];

// total can be any numbers equeals to or greater than the sum of all values
const total = 20000;

const injectedData = colorSeq(total, data);
// results:
// [
//   { label: 'John Wick', value: 100, color: '#c7b688' },
//   { label: 'Tony Stark', value: 18000, color: '#886c9e' },
//   ...
// ]

Options

namevaluedescription
format'hash' or 'rgb'The format of output color string. Default 'hash'.
injecttrue or falsedefine the return array. Set true to return the original array of object with a key color injected, set false to return an array of object with only the key color.
satBase0 - 100Base of Saturation value. Default 18. Better not touching it unless you know about colouring.
satRangenumberRange of variations of Saturation that inputs can alter. Related to satBase. Better not touching it unless you know about colouring.
lumBase0 - 100Base of Lightness value. Default 54. Better not touching it unless you know about colouring.
lumRangenumberRange of variations of Lightness that inputs can alter. Related to satBase. Better not touching it unless you know about colouring.
0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago