Skip to content

jacoborus/hexterm

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

hexterm

Get the xterm closest color to a hexadecimal color.

It works in Node.js, Deno and browsers

Build Status npm version deno version

Usage

Programatically

# only node.js
npm install hexterm
// deno
import { hexterm } from "https://deno.land/x/hexterm/src/hexterm.ts";
// node.js
import { hexterm } from "hexterm";

hexterm("005fd7"); // 26
hexterm("#005fd7"); // 26
hexterm("005ED9"); // 26
hexterm("ff0"); // 11
hexterm("#ff0"); // 11

CLI

Install globally

# deno
deno install -n hexterm https://deno.land/x/hexterm/src/cli.ts

# node
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'

Alternatively, you can call hexterm using npx

npx hexterm 005fd7

Test

Install dev-dependencies and run tests

npm install && npm tst

Development

Use VR (Velociraptor) to run the scripts.

vr build # builds npm module in npm folder

© 2016-2020 Jacobo Tabernero - Released under MIT License