index : logbot | |
Archlinux32 log bot | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-11-14 23:55:43 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-11-14 23:55:43 +0100 |
commit | a3e00c39d57a2469a6787342ad917bce644308ac (patch) | |
tree | 2c90ca05f782b38a82edc0f323250692b9c2ad9e /logbot.py | |
parent | 3b7436c65b8f042b57269124f84e818943d9755b (diff) |
-rwxr-xr-x | logbot.py | 13 |
@@ -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 |