From f92a14fc84038a30f08846c9dc564978aaded55e Mon Sep 17 00:00:00 2001 From: faumaray Date: Wed, 21 Oct 2026 05:31:35 +0300 Subject: [PATCH] Fall back to the name's colour for a chat whose server is gone server_tint answered opaque black for a server that is not in the list, where the Slint version answered transparent. It now answers none, and the direct-message list picks the colour of the chat's own title, as it does for every chat that is not a server's. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-ui/src/messages.rs | 8 +++++--- crates/voelin-ui/src/servers.rs | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) 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