From b4b43c488e56f9955bf011779e5df3c017b1ffb5 Mon Sep 17 00:00:00 2001 From: SamStrongTalks Date: Tue, 20 Feb 2024 12:17:14 -0500 Subject: [PATCH] Add nick coloring to nick_list - fixes #231 --- src/buffer/channel.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/buffer/channel.rs b/src/buffer/channel.rs index 309dbdabe..cd9c18cba 100644 --- a/src/buffer/channel.rs +++ b/src/buffer/channel.rs @@ -101,7 +101,7 @@ pub fn view<'a>( let users = clients.get_channel_users(&state.server, &state.channel); let channels = clients.get_channels(&state.server); - let nick_list = nick_list::view(users).map(Message::UserContext); + let nick_list = nick_list::view(users, config).map(Message::UserContext); let show_text_input = match config.buffer.input_visibility { data::buffer::InputVisibility::Focused => is_focused && status.connected(), @@ -218,7 +218,7 @@ impl Channel { } mod nick_list { - use data::User; + use data::{User, Config}; use iced::widget::{column, container, scrollable, text}; use iced::Length; use user_context::Message; @@ -227,7 +227,7 @@ mod nick_list { use crate::theme; use crate::widget::Element; - pub fn view(users: &[User]) -> Element { + pub fn view<'a>(users: &[User], config: &'a Config) -> Element<'a,Message> { let column = column(users.iter().map(|user| { let content = text(format!( "{}{}", @@ -237,7 +237,9 @@ mod nick_list { .style(if user.is_away() { theme::Text::Transparent } else { - theme::Text::Primary + theme::Text::Nickname( + user.color_seed(&config.buffer.nickname.color) + ) }); user_context::view(content, user.clone())