aboutsummaryrefslogtreecommitdiff
path: root/name2color.py
diff options
context:
space:
mode:
Diffstat (limited to 'name2color.py')
-rwxr-xr-xname2color.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/name2color.py b/name2color.py
new file mode 100755
index 0000000..e68149f
--- /dev/null
+++ b/name2color.py
@@ -0,0 +1,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)]))