1.0.1 • Published 3 years ago

@enigmaoffline/node-color v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Node Color

Simple color managing package for NodeJS Includes features such as

  • Hexcode to color array conversions
  • Color mixing with variable alpha values

Install

Installing with npm npm i --save @enigmaoffline/color

Usage

const Color = require('@enigmaoffline/color');


// basic functions
console.log(Color.valuesToHex(12, 34, 56, false));
// => '0c2238'

console.log(Color.arrToHex([12, 34, 56]));          
// => '#0c2238'

console.log(Color.hexToArr('#0c2238'));            
// => [ 12, 34, 56 ]


// color mixing
console.log(Color.mixByArray([12, 34, 56], [56, 34, 12]));
// => [ 34, 34, 34 ]

console.log(Color.mixByHex('#0c2238', '38220C'));
// => [ 34, 34, 34 ]

console.log(Color.mixByValue(25, 25, 25, 125, 125, 125));
// => [ 75, 75, 75 ]

console.log(Color.mixByValue(25, 25, 25, 125, 125, 125, 0.75));
// => [ 50, 50, 50 ]

LICENSE - MIT - Lo Chung Tin