Skip to content

TooTallNate/ansi-hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansi-hash

const chalk = require('chalk');
const hash = require('ansi-hash')();

function log(namespace, line) {
  const color = chalk.ansi256(hash(namespace));
  console.log(`[${color(namespace)}] ${line}`);
}

log('server1', 'Hello');

screen shot 2018-02-27 at 5 58 47 pm

About

Get an ANSI color code for a given string

Resources

Stars

Watchers

Forks

Packages