diff options
author | mathieui <mathieui@mathieui.net> | 2021-02-17 21:43:43 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-02-17 22:04:20 +0100 |
commit | ee8a3c11210d1b5a14fdb9c9a760e100c79b3d93 (patch) | |
tree | 4979a2b06c8d51f176eb8dc7002aba6fe8b7e0ee /poezio/user.py | |
parent | 5a9e143c53ce6958a09737c8ed8d57924fc9206f (diff) | |
download | poezio-ee8a3c11210d1b5a14fdb9c9a760e100c79b3d93.tar.gz poezio-ee8a3c11210d1b5a14fdb9c9a760e100c79b3d93.tar.bz2 poezio-ee8a3c11210d1b5a14fdb9c9a760e100c79b3d93.tar.xz poezio-ee8a3c11210d1b5a14fdb9c9a760e100c79b3d93.zip |
muc: remove non-deterministic nick colors
Diffstat (limited to 'poezio/user.py')
-rw-r--r-- | poezio/user.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/poezio/user.py b/poezio/user.py index 3724d229..858c6d0e 100644 --- a/poezio/user.py +++ b/poezio/user.py @@ -38,7 +38,6 @@ class User: status: str, role: str, jid: JID, - deterministic=True, color='') -> None: # The oldest possible time self.last_talked: datetime = datetime(1, 1, 1) @@ -48,12 +47,9 @@ class User: self.chatstate: Optional[str] = None self.color: Tuple[int, int] = (1, 1) if color != '': - self.change_color(color, deterministic) + self.change_color(color) else: - if deterministic: - self.set_deterministic_color() - else: - self.color = choice(get_theme().LIST_COLOR_NICKNAMES) + self.set_deterministic_color() def set_deterministic_color(self) -> None: theme = get_theme() @@ -82,14 +78,10 @@ class User: def change_nick(self, nick: str): self.nick = nick - def change_color(self, color_name: Optional[str], deterministic=False): + def change_color(self, color_name: Optional[str]): color = xhtml.colors.get(color_name or '') if color is None: - if deterministic: - self.set_deterministic_color() - else: - log.error('Unknown color "%s"', color_name) - self.color = choice(get_theme().LIST_COLOR_NICKNAMES) + self.set_deterministic_color() else: self.color = (color, -1) |