random-color
This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
Last updated 11 years ago by npm .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install random-color 
SYNC missed versions from official npm registry.

random-color

Generate random colors based on the golden ratio, which are more visually pleasing.

MIT License

build:? coverage:?

This module is deeply inspired by Martin Ankerl's blog post.

The generated colors are more visually pleasing together than a simple random color generator because they are computed by moving around the color wheel in increments of the golden ratio. By default, the generated colors can used as a background for legible black text, but the color generator can be customized for other uses.

Install

$ npm install --save random-color

Usage

var randomColor = require('random-color');

// API
// - randomColor([saturation, value]);

By default, generate a color with saturation = 0.5 and value = 0.95.

Returns color object so you can convert the color to any color-formats easily.

var color = randomColor();

// ref: https://github.com/harthur/color
color.hexString(); // => '#d67118'
color.rgbString(); // => 'rgb(110,52,164)'

saturation=0.5, value=0.95

Optionally specify saturation and value:

var color = randomColor(0.99, 0.99);

saturation=0.99, value=0.99

var color = randomColor(0.3, 0.99);

saturation=0.3, value=0.99

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

Current Tags

  • 1.0.1                                ...           latest (11 years ago)

7 Versions

  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1-security                                ...           11 years ago
  • 2.0.0                                ...           11 years ago
  • 0.0.1                                ...           12 years ago
  • 0.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 12
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE