Skip to content

Quickly find the nearest xterm 256 color index of an RGB.

License

Notifications You must be signed in to change notification settings

userElaina/python-x256-offline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-x256-offline

Quickly find the nearest xterm 256 color index of an RGB.

Installation
python -m pip install x256offline
Simple Example
import x256offline as x256

c0 = 0x23307b
x0e = x256.from_rgb(c0)
x0w = x256.from_rgb(c0, weighted=True)

print(hex(c0))
print(x0e, hex(x256.to_rgb(x0e)))
print(x0w, hex(x256.to_rgb(x0w)))

# 0x23307b
# 4 0x80
# 24 0x5f87