x256
return the nearest xterm 256 color code for rgb inputs.
example
You can just print the index:
var x256 = ;var ix = ;console;
output:
162
or you can use raw ansi escape codes:
var x256 = ;var ix = ;console;
output:
or you can use charm:
var x256 = ;var charm = processstdout;var ix = ;charm;
output:
methods
var x256 = require('x256')
x256(red, green, blue)
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.
attributes
x256.colors
array of [red,green,blue]
24-bit color arrays indexed by xterm 256 color code
install
With npm do:
npm install x256
license
MIT