Convert hexadecimal color codes to closest Xterm
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin New: add CLI tool Apr 27, 2016
.gitignore
LICENSE
README.md
hexterm.js
package.json
tests.js

README.md

hexterm

Get the xterm closest color to a hexadecimal color

Usage

Programatically

Install locally

npm install hexterm

Require hexterm and pass a string to it

const hexterm = require('hexterm')

hexterm('005fd7') // 26
hexterm('#005fd7') // 26
hexterm('005ED9') // 26
hexterm('ff0') // 11
hexterm('#ff0') // 11

CLI

Install globally

npm install -g hexterm

Call from your shell: hexterm <color>

hexterm 005fd7

Remember to wrap the color code between quotes if has numeral prefix (#)

hexterm '#ff0'

Test

Install dev-dependencies and run tests

npm install && npm tst



© 2016 Jacobo Tabernero - Released under MIT License