diff --git a/crates/voelin-ui/src/messages.rs b/crates/voelin-ui/src/messages.rs index 7d377a5..3325e5a 100644 --- a/crates/voelin-ui/src/messages.rs +++ b/crates/voelin-ui/src/messages.rs @@ -220,11 +220,13 @@ impl App { ago: ago(ts).into(), unread: chat.unread, initials: vm::avatar::initials(&title).into(), - // A server's chat in the server's colour. + // A server's chat in the server's colour; a name's own colour + // when the server is gone. tint: match (kind, session) { (0, Some(s)) => self.server_tint(s), - _ => vm::avatar::tint(&title), - }, + _ => None, + } + .unwrap_or_else(|| vm::avatar::tint(&title)), avatar, online, selected: open.is_some_and(|o| { diff --git a/crates/voelin-ui/src/servers.rs b/crates/voelin-ui/src/servers.rs index 93853ee..a2fa32e 100644 --- a/crates/voelin-ui/src/servers.rs +++ b/crates/voelin-ui/src/servers.rs @@ -450,10 +450,12 @@ impl App { } } - /// A server's colour, as the rail shows it ([`vm::servers::tints`]). - pub(crate) fn server_tint(&self, id: i64) -> vm::Rgb { + /// A server's colour, as the rail shows it ([`vm::servers::tints`]); none + /// for a server that is not in the list (a chat that outlived its + /// bookmark), where the caller picks a colour of its own. + pub(crate) fn server_tint(&self, id: i64) -> Option { let tints = vm::servers::tints(&self.state.bookmarks); - self.state.bookmarks.iter().position(|b| b.id == id).map(|i| tints[i]).unwrap_or_default() + self.state.bookmarks.iter().position(|b| b.id == id).map(|i| tints[i]) } /// The rail: servers with their state, unread count (without private