node-random-color
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

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-color

Example

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
#7C3fD0

Visualization

Visualization

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 difference and considerations are both too high, it might not be able to generate colors.
  • brightness : Choose to generate bright or dark colors. (optional, boolean)

Readme

Keywords

Package Sidebar

Install

npm i node-random-color

Weekly Downloads

27

Version

0.2.0

License

MIT

Unpacked Size

29.7 kB

Total Files

16

Last publish

Collaborators

  • rulyox