Skip to main content
Home
Works with
This package works with Deno, Browsers
This package works with Deno
This package works with Browsers
JSR Score94%
Downloads72/wk
Published2 years ago (2.1.1)

Get the xterm closest color to a hexadecimal color

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

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@jacoborus/hexterm

Import symbol

import * as hexterm from "@jacoborus/hexterm";
or

Import directly with a jsr specifier

import * as hexterm from "jsr:@jacoborus/hexterm";