Skip to content

Commit

Permalink
Add nick coloring to nick_list
Browse files Browse the repository at this point in the history
- fixes #231
  • Loading branch information
SamStrongTalks authored and zchrykng committed Feb 20, 2024
1 parent f0336eb commit b4b43c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/buffer/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
Expand All @@ -227,7 +227,7 @@ mod nick_list {
use crate::theme;
use crate::widget::Element;

pub fn view(users: &[User]) -> Element<Message> {
pub fn view<'a>(users: &[User], config: &'a Config) -> Element<'a,Message> {
let column = column(users.iter().map(|user| {
let content = text(format!(
"{}{}",
Expand All @@ -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())
Expand Down

0 comments on commit b4b43c4

Please sign in to comment.