aboutsummaryrefslogtreecommitdiff
path: root/name2color.py
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2020-05-20 15:47:39 -0400
committerDeterminant <tederminant@gmail.com>2020-05-20 15:47:39 -0400
commit6a0f63a25393dd51c5b6937269d9423d18df91ed (patch)
tree9874bf301a2d3dde77861e7fc6e8abac15b64246 /name2color.py
init
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)]))