# @rdshah/colors

> Generate stream of unique colors

Latest version **1.1.3** (published 2022-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rdshah/colors
pnpm add @rdshah/colors
yarn add @rdshah/colors
bun add @rdshah/colors
```

## 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.1.3 |
| Published | 2022-01-13 |
| First published | 2022-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rdshah |
| Maintainers | rdshah |
| Keywords | tiny, color, palette |

## Links

- npm: https://www.npmjs.com/package/@rdshah/colors
- npm.io page: https://npm.io/package/@rdshah/colors

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K 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

## Recent versions

- 1.1.3 (latest) — 2022-01-13
- 1.1.2 — 2022-01-09
- 1.1.1 — 2022-01-09
- 1.1.0 — 2022-01-09
- 1.0.0 — 2022-01-09

## README

# colors

Generates a stream of colors that roughly maximizes contrast regardless of how many colors are generated.

## getGenerator(format: "hex" | "rgb" | "rgba" | "raw")

Returns an object which generates colors in the specified format.  Object has two methods

* next // returns the next color and increments the state of the generator
* peek // returns the next color without changing the state of the generator

Example usage
```
import { getGenerator } from "@rdshah/colors";

myGenerator = getGenerator('hex');
myGenerator.next(); // '#ff0000'
myGenerator.next(); // '#00ccff'
myGenerator.next(); // '#98ff00'
myGenerator.peek(); // '#ff0064'
myGenerator.next(); // '#ff0064'

myGenerator2 = getGenerator('hex');
myGenerator2.next(); // '#ff0000'
```

## globalGenerator

Is an instatiation of getGenerator in the `rgb` format.

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