Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Gustu/string-to-color
Time invariant color from any object.
https://github.com/Gustu/string-to-color
color javascript npm
Last synced: 2 months ago
JSON representation
Time invariant color from any object.
- Host: GitHub
- URL: https://github.com/Gustu/string-to-color
- Owner: Gustu
- License: mit
- Created: 2016-03-25T13:40:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T17:00:52.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T23:37:49.895Z (3 months ago)
- Topics: color, javascript, npm
- Language: JavaScript
- Homepage:
- Size: 301 KB
- Stars: 184
- Watchers: 4
- Forks: 13
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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.