string-to-color
TypeScript icon, indicating that this package has built-in type declarations

2.2.2 • Public • Published

String to color

Alt text

npm version

Generate time invariant color from any string or any object.

Install

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

Demo

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

Usage

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

or just generate color from any object, even null!

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

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

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

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

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

License

MIT.

/string-to-color/

    Package Sidebar

    Install

    npm i string-to-color

    Weekly Downloads

    30,470

    Version

    2.2.2

    License

    MIT

    Unpacked Size

    34.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • hyazeh