aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-11 12:48:37 +0000
committerGravatar jesopo2019-11-11 12:48:37 +0000
commitb7bfd414be5d9536dbca0d5a2182d661c894802c (patch)
treea409cc274a5c895138af7d1e32b8c3527bb2fc12 /src/utils
parent.lower() strings when hash-colorizing them (diff)
signature
hash_colorize code should first be looked up in HASH_COLORS
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/irc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py
index 91a4cc4f..719d55b8 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -43,8 +43,8 @@ def color(s: str, foreground: consts.IRCColor,
HASH_COLORS = list(range(2, 16))
def hash_colorize(s: str):
- code = sum(ord(c) for c in s.lower())%len(HASH_COLORS)
- return color(s, consts.COLOR_CODES[code])
+ hash_code = sum(ord(c) for c in s.lower())%len(HASH_COLORS)
+ return color(s, consts.COLOR_CODES[HASH_COLORS[hash_code]])
def bold(s: str) -> str:
return "%s%s%s" % (consts.BOLD, s, consts.BOLD)