blob: 988b5cd9423d6c41cc6942855c305e08fd708579 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/usr/bin/env python
import os, sys, argparse, os.path, json, re
import xtermcolors
# Resolve HTML-style hex RGB color codes to xterm-256color color numbers
if len(sys.argv) != 2:
print('Usage: resolvecolor.py #RRGGBB')
exit()
print(xtermcolors.closest_color(*[int(s, 16) for s in re.match('#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})', sys.argv[1]).groups()]))
|