New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hashbow

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashbow

Hexadecimal hashes of everything

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

hashbow

Hashbow creates hexadecimal colors of everything. You can think of it like a crypto library, but instead of outputting md5s or sha1s it turns everything into color hashes.

hashbow('Bruce Willis')

outputs #40BFA8, a lovely mid turquiose blue.

whereas

hashbow('Nicolas Cage')

outputs a #BFA840, a Dijon Mustard kind of color.

But whats the point?

Hashbow's color conversion is consistent, so every time you call hashbow('Bruce Willis') you will get the same lovely mid turquoise blue. This is very useful for assigning your users a color, brightening up a comment area, etc.

Hashbow uses the HSL colorspace to make it easy to get colors that work well together. The first parameter is used to calculate the hue of the result. You can also pass in custom saturation and lightness if you need to tweak (default is 50).

hashbow('Bruce Willis', 30);

Outputs #669990, a calmer seafoam green.

Setting the saturation to 0 will make everything greyscale.

hashbow('Bruce Willis', 0);

Outputs #7E8180

Hashbow will create color hashes of anything and everything, Strings, Objects, Functions, Numbers, whatever, etc.

Installation

npm install hashbow

Usage

hashbow(thingyToHash, saturation, lightness)

Example

const hashbow = require('hashbow');
const actors = ['Bruce Willis', 'Nicolas Cage', 'Leonardo Di Caprio'];

actors.forEach(actor => {

  const el = document.createElement('div');

  el.innerHTML = actor;
  el.style.color = hashbow(actor);
  
  document.body.appendChild(el);

});

CLI

There is a CLI, just install globally

npm install hashbow --global

and then

hashbow boogers

Outputs #BF5340

You can use -s and -l to modify saturation and lightness too.

hashbow boogers -s 50 -l 22

Outputs #54241C

now you can color up your git logs, or like, something else that's cool

🙂️

Keywords

color

FAQs

Package last updated on 27 Apr 2016

Did you know?

Socket

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