aboutsummaryrefslogtreecommitdiff
path: root/name2color.py
blob: e68149f603988cc559e6cfd59e16e8fd7a32885f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python3
import sys
import hashlib
# add your favorite color code (256) here as candidates
colors = [
    63, 64, 65, 68, 103, 107,
    166, 168, 172, 208, 203,
    160, 161, 167, 137, 131
]
h = hashlib.sha1(sys.argv[1].encode('utf-8')).digest()
print("colour{}".format(colors[h[0] % len(colors)]))