Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including hexterm with all npm packages installed. Try it out:

var hexterm = require("hexterm")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

hexterm v1.2.0

Convert hex colors to closest xterm


Get the xterm closest color to a hexadecimal color



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


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'


Install dev-dependencies and run tests

npm install && npm tst

© 2016 Jacobo Tabernero - Released under MIT License

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free