# random-color

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

Latest version **1.0.1** (published 2016-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-color
pnpm add random-color
yarn add random-color
bun add random-color
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-04-26 |
| First published | 2013-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 38 |
| Author | bubkoo |
| Maintainers | bubkoo |
| Keywords | color, rgb, hex, random, randomly, randomize, chance, test, dice, mock |

## Links

- npm: https://www.npmjs.com/package/random-color
- Repository: https://github.com/mock-end/random-color
- Homepage: https://github.com/mock-end/random-color#readme
- Issues: https://github.com/mock-end/random-color/issues
- npm.io page: https://npm.io/package/random-color

## Dependencies (1)

- [color](https://npm.io/package/color.md) ^0.11.1

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads
- [colour-proximity](https://npm.io/package/colour-proximity.md) — 49 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-04-26
- 1.0.0 — 2016-04-18
- 0.0.2 — 2016-04-10
- 0.0.1-security — 2016-03-23
- 2.0.0 — 2016-03-22
- 0.0.1 — 2014-08-15
- 0.0.0 — 2013-06-17

## README

# random-color

> Generate random colors based on the golden ratio, which are more visually pleasing.
  
[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/mock-end/random-color/blob/master/LICENSE)

[![build:?](https://img.shields.io/travis/mock-end/random-color/master.svg?style=flat-square)](https://travis-ci.org/mock-end/random-color)
[![coverage:?](https://img.shields.io/coveralls/mock-end/random-color/master.svg?style=flat-square)](https://coveralls.io/github/mock-end/random-color)
  

This module is deeply inspired by Martin Ankerl's [blog post](http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/). 

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

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

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

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

Returns [color](https://github.com/harthur/color) object so you can convert the color to any color-formats easily.

```js
var color = randomColor();

// ref: https://github.com/harthur/color
color.hexString(); // => '#d67118'
color.rgbString(); // => 'rgb(110,52,164)'
```
![saturation=0.5, value=0.95](img/1.png?raw=true "saturation=0.5, value=0.95")


Optionally specify `saturation` and `value`:

```js
var color = randomColor(0.99, 0.99);
```
![saturation=0.99, value=0.99](img/2.png?raw=true "saturation=0.99, value=0.99")

```js
var color = randomColor(0.3, 0.99);
```
![saturation=0.3, value=0.99](img/1.png?raw=true "saturation=0.3, value=0.99")

## Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please [create an issue](https://github.com/mock-end/random-color/issues/new).

---
_Source: https://npm.io/package/random-color · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
