diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8d9a8b6..4ae9f6d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +Added: + +- Option to colorize nicks in the nick list (and an option to control it separately from in the buffer) + Fixed: - Input not visible on Server and Query (DM) buffers diff --git a/config.yaml b/config.yaml index 8eecfc57b..f34d107dc 100644 --- a/config.yaml +++ b/config.yaml @@ -104,6 +104,11 @@ buffer: # - Left: Left side of pane # - Right: Right side of pane [default] position: Right + # User list color settings: + # - Unique: Unique user colors [default] + # - Solid: Solid user colors + color: Unique + # Dashboard settings dashboard: diff --git a/data/src/buffer.rs b/data/src/buffer.rs index 617a17e04..f67bd0148 100644 --- a/data/src/buffer.rs +++ b/data/src/buffer.rs @@ -93,7 +93,7 @@ impl Brackets { } } -#[derive(Debug, Clone, Default, Deserialize)] +#[derive(Debug, Clone, Copy, Default, Deserialize)] pub enum Color { Solid, #[default] diff --git a/data/src/config/channel.rs b/data/src/config/channel.rs index e49313e6f..fb0e0bb4e 100644 --- a/data/src/config/channel.rs +++ b/data/src/config/channel.rs @@ -1,5 +1,6 @@ use serde::Deserialize; +use crate::buffer::Color; use crate::channel::Position; #[derive(Debug, Clone, Default, Deserialize)] @@ -11,6 +12,8 @@ pub struct Users { pub(crate) visible: bool, #[serde(default)] pub position: Position, + #[serde(default)] + pub color: Color, } impl Default for Users { @@ -18,6 +21,7 @@ impl Default for Users { Self { visible: true, position: Position::default(), + color: Color::default(), } } } diff --git a/src/buffer/channel.rs b/src/buffer/channel.rs index 309dbdabe..b19f97318 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.channel.users.color) + ) }); user_context::view(content, user.clone())