https://github.com/jacoborus/hexterm
Convert hexadecimal color codes to closest Xterm
https://github.com/jacoborus/hexterm
convert hexadecimal-color xterm
Last synced: 6 months ago
JSON representation
Convert hexadecimal color codes to closest Xterm
- Host: GitHub
- URL: https://github.com/jacoborus/hexterm
- Owner: jacoborus
- License: mit
- Created: 2016-04-24T16:50:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-14T00:50:44.000Z (almost 2 years ago)
- Last Synced: 2024-10-16T15:03:58.708Z (about 1 year ago)
- Topics: convert, hexadecimal-color, xterm
- Language: TypeScript
- Size: 409 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hexterm
Get the xterm closest color to a hexadecimal color.
It works in Node.js, Deno and browsers
[](https://jsr.io/@jacoborus/hexterm)
[](https://www.npmjs.com/package/hexterm)
## Usage
### Programatically
```js
// 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
```sh
# deno
deno install -n hexterm jsr:@jacoborus/hexterm/cli
# node
npm install -g hexterm
```
Call from your shell: `hexterm `
```sh
hexterm 005fd7
```
Remember to wrap the color code between quotes if has numeral prefix (`#`)
```sh
hexterm '#ff0'
```
Alternatively, you can call **hexterm** using npx
```sh
npx hexterm 005fd7
```
## Test
```sh
deno test
```
## Development
To build npm compatible module:
```sh
deno task build-npm
```
---
© 2016-2024 [Jacobo Tabernero Rey](https://github.com/jacoborus) - Released under
[MIT License](https://raw.github.com/jacoborus/hexterm/master/LICENSE)