find the nearest xterm 256 color index for an rgb
npm install x256return the nearest
xterm 256 color code
for rgb inputs.


You can just print the index:
`` js`
var x256 = require('x256');
var ix = x256(220,40,150);
console.log(ix);
output:
``
162
or you can use raw ansi escape codes:
` js`
var x256 = require('x256');
var ix = x256(220,40,150);
console.log('\x1b38;5;' + ix + 'mBEEEEEP');
output:
![x256 raw beep
or you can use charm:
` js
var x256 = require('x256');
var charm = require('charm')(process.stdout);
var ix = x256(220,40,150);
charm.foreground(ix).write('beep boop');
`
output:
``
var x256 = require('x256')
Return the nearest xterm 256 color code for the 24-bit [red, green, blue]
values.
red, green, and blue should each be integers from 0 through 255,
inclusive.
array of [red,green,blue] 24-bit color arrays indexed by xterm 256 color code
With npm do:
```
npm install x256
MIT