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 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad2097963e
commit
f92a14fc84
2 files changed
+10
-6
No files matched your search
@@ -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| {
|
||||
|
||||
@@ -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<vm::Rgb> {
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user