0.2.0 • Published 5 years ago
node-random-color v0.2.0
Random Color Generator
node-random-color is a package that can be used to easily generate colors.
Options are available to make the generated colors dissimilar.
Installation
npm install node-random-colorExample
Usage
const randomColor = require('node-random-color');
console.log('Generate 5 random colors');
for(let i = 0; i < 5; i++) {
const color = randomColor({
difference: 150,
considerations: 5
});
console.log(color);
}Result
Generate 5 random colors
#A57B98
#6ACB45
#3C509F
#AF9F3D
#7C3fD0Visualization

Options
difference: Minimum difference from previous colors. If larger, more different colors will be generated. (optional, number) (default is 150)considerations: The number of previous colors to consider. (optional, number) (default is 5)- If
differenceandconsiderationsare both too high, it might not be able to generate colors. brightness: Choose to generate bright or dark colors. (optional, boolean)