Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tootallnate/ansi-hash
- Owner: TooTallNate
- Created: 2018-02-28T01:30:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T02:00:25.000Z (almost 7 years ago)
- Last Synced: 2024-12-10T14:06:43.310Z (17 days ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
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');
```