Skip to content

jacoborus/hexterm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexterm

Get the xterm closest color to a hexadecimal color.

It works in Node.js, Deno and browsers

JSR npm version

Usage

Programatically

// deno
import { hexterm } from "jsr:@jacoborus/hexterm";
// 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 jsr:@jacoborus/hexterm/cli

# 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

deno test

Development

To build npm compatible module:

deno task build-npm

© 2016-2024 Jacobo Tabernero Rey - Released under MIT License