Quickly find the nearest xterm 256 color index of an RGB (NumPy Version)
Project description
Quickly find the nearest xterm 256 color index of an RGB.
NumPy version of python-x256-offline.
Installation
python -m pip install x256numpy
Simple Example
import x256numpy as x256
c0 = 0x297331
b, g, r = c0 & 0xff, (c0 >> 8) & 0xff, (c0 >> 16) & 0xff
x0e = x256.from_rgb(r, g, b, weighted=False, n_color=232)
x0w = x256.from_rgb(r, g, b, weighted=True, n_color=232)
x1e = x256.from_rgb(r, g, b, weighted=False, n_color=256)
x1w = x256.from_rgb(r, g, b, weighted=True, n_color=256)
print('%06x %d %06x %d %06x %d %06x %d %06x' % (
c0,
x0e, x256.to_rgb(x0e),
x0w, x256.to_rgb(x0w),
x1e, x256.to_rgb(x1e),
x1w, x256.to_rgb(x1w)
))
# 297331 23 005f5f 2 008000 238 444444 239 4e4e4e
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
x256numpy-0.0.1.tar.gz
(262.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
x256numpy-0.0.1-py3-none-any.whl
(261.8 kB
view details)
File details
Details for the file x256numpy-0.0.1.tar.gz.
File metadata
- Download URL: x256numpy-0.0.1.tar.gz
- Upload date:
- Size: 262.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e62dc262049fb5b8ec82652f1d7f01b21535e6ef41b3bc41170fc1a317b4c0
|
|
| MD5 |
efeebe2ca712d5d38c23a9fdcf339324
|
|
| BLAKE2b-256 |
f4f4cdde4ee69f62529999d15dd80e8a8964908152e98debeb9468b75cd38749
|
File details
Details for the file x256numpy-0.0.1-py3-none-any.whl.
File metadata
- Download URL: x256numpy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 261.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41c975c4c2d7e24d93a7bac8b0f63ab1755c059e6abfd827ed3e535aff143bdc
|
|
| MD5 |
dfb4b89fa8fd903b57f256efce0f3750
|
|
| BLAKE2b-256 |
156f7727dd8f7048abbb7663381443a4182c9dfb6c991dd1fb6c5054860f5131
|