From a3e00c39d57a2469a6787342ad917bce644308ac Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 14 Nov 2017 23:55:43 +0100 Subject: logbot.py: make light colors darker --- logbot.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'logbot.py') 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 -- cgit v1.2.3-70-g09d2