hash_colorize code should first be looked up in HASH_COLORS

This commit is contained in:
jesopo 2019-11-11 12:48:37 +00:00
parent 727fb3427d
commit b7bfd414be

View file

@ -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)