color-id

1.1.0 • Public • Published

color-id unstable Build Status

Convert color channels to single integer and back. Useful to get an id for a color.

npm install color-id

const colorId = require('color-id');
 
colorId([.1, .5, .5, .1]); // 0x197f7f19

colorId(channels, normalized=true)

Get id for normalized to 0..1 rgb[a] channel values. Optionally pass normalized flag to indicate that values are normalized to 0..1 range, defaults to true.

colorId.from(number, normalized=true)

Get color channels values from the color id. Optionally pass normalized flag to align values to 0..1 range.

Related

color-interpolate — interpolate color over palette, colormap or gradient.
color-rgba — convert color string to rgba array.
color-alpha — change alpha channel for a color.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    215,198
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    215,198
  • 1.0.3
    1
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i color-id

Weekly Downloads

215,200

Version

1.1.0

License

MIT

Last publish

Collaborators

  • dfcreative