rgb2ansithanks xero
hexadecimal triplet to 256 color equivalent
usage
rgb2ansi -n ff0000
to get the numeric value of the 256 color equivalent of #ff0000
(red).
rgb2ansi -b ff0000
to set the background to red equivalent.
rgb2ansi -f ff0000
to set the foreground to red equivalent.