Socket
Socket
Sign inDemoInstall

string-to-color

Package Overview
Dependencies
6
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    string-to-color

Generates color from any string or any object


Version published
Weekly downloads
28K
decreased by-3.57%
Maintainers
1
Install size
135 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 06 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc