aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-11 12:13:46 +0000
committerGravatar jesopo2019-11-11 12:13:46 +0000
commitac30f8d4cc7413fe85a59690dc674ff75f432f7c (patch)
tree293f93eae3422d5494bb41bcb128e7523fac43d8 /src
parentadd utils.irc.hash_colorize() to color a string by the string's hash (diff)
signature
don't use hash() for hashed colorising as it's not stable through restarts
Diffstat (limited to 'src')
-rw-r--r--src/utils/irc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py
index 59151a75..d44825d8 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -43,7 +43,7 @@ def color(s: str, foreground: consts.IRCColor,
HASH_COLORS = list(range(2, 16))
def hash_colorize(s: str):
- code = hash(s)%len(HASH_COLORS)
+ code = sum(ord(c) for c in s)%len(HASH_COLORS)
return color(s, consts.COLOR_CODES[code])
def bold(s: str) -> str: