Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tootallnate/ansi-hash

Get an ANSI color code for a given string
https://github.com/tootallnate/ansi-hash

Last synced: 5 days ago
JSON representation

Get an ANSI color code for a given string

Awesome Lists containing this project

README

        

# ansi-hash

```js
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