Repository
Current version released
4 years ago
Versions
deno_x256
Find the nearest xterm 256 color index for an rgb.
colors data source https://cdn.jsdelivr.net/gh/substack/node-x256@master/colors.json
Usage
All xterm 256 colors:
import color from "https://deno.land/x/x256/color.ts";
console.log(color)
output:
[
"000000",
"800000",
"008000",
"808000",
"000080",
"800080",
...
...
Get the nearest xterm 256 color code for rgb inputs.:
import x256 from "https://deno.land/x/x256/mod.ts";
const c = x256(220,40,150);
console.log(c); // 162
Use raw ansi escape codes:
Check if the language code is valid:
import x256 from "https://deno.land/x/x256/mod.ts";
const c = x256(220,40,150);
console.log(`\x1b[38;5;${c}mBEEEEEP`);
License
deno_x256 is released under the MIT License. See the bundled LICENSE file for details.