# string-to-color

> Generates color from any string or any object

Latest version **2.2.2** (published 2020-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install string-to-color
pnpm add string-to-color
yarn add string-to-color
bun add string-to-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 | 2.2.2 |
| Published | 2020-08-06 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 33.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 190 |
| Author | Bartłomiej Pasik |
| Maintainers | hyazeh |
| Keywords | color, text, string, generate |

## Links

- npm: https://www.npmjs.com/package/string-to-color
- Repository: https://github.com/Gustu/string-to-color
- Homepage: https://github.com/Gustu/string-to-color#readme
- Issues: https://github.com/Gustu/string-to-color/issues
- npm.io page: https://npm.io/package/string-to-color

## Dependencies (6)

- [hex-rgb](https://npm.io/package/hex-rgb.md) ^4.1.0
- [rgb-hex](https://npm.io/package/rgb-hex.md) ^3.0.0
- [colornames](https://npm.io/package/colornames.md) ^1.1.1
- [lodash.words](https://npm.io/package/lodash.words.md) ^4.2.0
- [lodash.padend](https://npm.io/package/lodash.padend.md) ^4.6.1
- [lodash.trimstart](https://npm.io/package/lodash.trimstart.md) ^4.5.1

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

- 2.2.2 (latest) — 2020-08-06
- 2.2.1 — 2020-07-21
- 2.2.0 — 2020-07-21
- 2.1.5 — 2020-07-20
- 2.1.4 — 2020-05-26
- 2.1.3 — 2020-02-25
- 2.1.2 — 2020-02-17
- 2.1.1 — 2019-05-07
- 2.0.1 — 2018-11-15
- 2.0.0 — 2018-02-20
- 1.0.1 — 2017-08-28
- 1.0.0 — 2016-05-15
- 0.0.6 — 2016-04-04
- 0.0.5 — 2016-04-02
- 0.0.4 — 2016-03-31
- … 3 more at https://npm.io/package/string-to-color/versions

## README

# String to color

![Alt text](/assets/img.png?raw=true "Sample")

[![npm version](https://badge.fury.io/js/string-to-color.svg)](https://badge.fury.io/js/string-to-color) ![](https://img.shields.io/npm/dm/string-to-color.svg)

Generate time invariant color from any string or any object.

## Install

```bash
npm install string-to-color
```
```bash
yarn add string-to-color
```

## Demo

https://gustu.github.io/string-to-color/

## Usage

```js
const stc = require('string-to-color');
const color = stc('string'); // => "#7f1de4"
```


or just generate color from any object, even null!

```js
const color = stc(null); // => "#1ad64b"
```

Another feature is that when your string contains color name, output will more or less equal to that color

```js
const color = stc("i am a red fox"); // => "#f03d22"
```

When multiple colors are provided, they will be mixed with each other

```js
const color = stc("red green blue"); // => "#7f5b78"
```

## License

MIT.

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