Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-14 23:55:43 +0100
committerErich Eckner <git@eckner.net>2017-11-14 23:55:43 +0100
commita3e00c39d57a2469a6787342ad917bce644308ac (patch)
tree2c90ca05f782b38a82edc0f323250692b9c2ad9e
parent3b7436c65b8f042b57269124f84e818943d9755b (diff)
logbot.py: make light colors darker
-rwxr-xr-xlogbot.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/logbot.py b/logbot.py
index e98586c..f091c04 100755
--- a/logbot.py
+++ b/logbot.py
@@ -231,7 +231,18 @@ class Logbot(SingleServerIRCBot):
self.connection.disconnect("Quitting...")
def color(self, user):
- return "#%s" % md5(user).hexdigest()[:6]
+ hash = md5(user).hexdigest()
+ r = int(hash[0:2],16)
+ g = int(hash[2:4],16)
+ b = int(hash[4:6],16)
+ if r>127 and g>127 and b>127:
+ if int(hash[6:10],16) < 21845:
+ r = r-128
+ elif int(hash[6:10],16) < 43691:
+ g = g-128
+ else:
+ b = b-128
+ return "#%0.2x%0.2x%0.2x" % (r, g, b)
def set_ftp(self, ftp=None):
self.ftp = ftp