Added two useful tools

This commit is contained in:
jaseg 2013-07-28 00:19:47 +02:00
parent 0995c90cf4
commit 2a74911541
2 changed files with 34 additions and 0 deletions

13
resolvecolor.py Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env python
import os, sys, argparse, os.path, json, re
from pygments.formatters import terminal256
formatter = terminal256.Terminal256Formatter()
if len(sys.argv) != 2:
print('Usage: resolvecolor.py #RRGGBB')
exit()
print(formatter._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()]))