From c65e2bf134d736b8558e407d0213032cd035e0a4 Mon Sep 17 00:00:00 2001 From: alice pellerin Date: Sat, 11 Apr 2026 18:58:27 -0500 Subject: [PATCH] update secondary selection head color --- src/app/widget.rs | 2 +- src/buffer/widget.rs | 12 ++++++------ src/custom_greys.rs | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/widget.rs b/src/app/widget.rs index 5d68471..cdbf039 100644 --- a/src/app/widget.rs +++ b/src/app/widget.rs @@ -29,7 +29,7 @@ impl App { fn tab_for(buffer: &Buffer, is_active: bool) -> Span<'static> { let background = if is_active { - Color::select_grey() + Color::selection_tail_grey() } else { Color::ui_grey() }; diff --git a/src/buffer/widget.rs b/src/buffer/widget.rs index 404fa65..fd900b9 100644 --- a/src/buffer/widget.rs +++ b/src/buffer/widget.rs @@ -260,15 +260,15 @@ use ratatui::{style::{Color, Style, Stylize}, text::Span}; match place_in_cursor { InCursor::Head => span.bg(head_color), - InCursor::Rest => span.bg(Color::select_grey()), + InCursor::Rest => span.bg(Color::selection_tail_grey()), } } else { match self.cursors .iter() .find_map(|cursor| cursor.contains(address)) { - Some(InCursor::Head) => span.on_gray(), - Some(InCursor::Rest) => span.bg(Color::select_grey()), + Some(InCursor::Head) => span.bg(Color::secondary_selection_head_grey()), + Some(InCursor::Rest) => span.bg(Color::selection_tail_grey()), None => span, } } @@ -286,7 +286,7 @@ use ratatui::{style::{Color, Style, Stylize}, text::Span}; .chain(&self.cursors) .any(|cursor| cursor.contains_space_before(address)) { - span.bg(Color::select_grey()) + span.bg(Color::selection_tail_grey()) } else { span } @@ -303,7 +303,7 @@ use ratatui::{style::{Color, Style, Stylize}, text::Span}; .chain(&self.cursors) .any(|cursor| cursor.contains_space_before(address)) { - span.bg(Color::select_grey()) + span.bg(Color::selection_tail_grey()) } else { span } @@ -392,7 +392,7 @@ mod character_panel { .chain(&self.cursors) .find_map(|cursor| cursor.contains(address)) { - Some(InCursor::Head) => span.bg(Color::select_grey()), + Some(InCursor::Head) => span.bg(Color::selection_tail_grey()), Some(InCursor::Rest) => span.on_dark_gray(), None => span, } diff --git a/src/custom_greys.rs b/src/custom_greys.rs index 817257b..ff4cf3e 100644 --- a/src/custom_greys.rs +++ b/src/custom_greys.rs @@ -1,15 +1,20 @@ use ratatui::style::Color; pub trait CustomGreys { - fn select_grey() -> Self; + fn selection_tail_grey() -> Self; + fn secondary_selection_head_grey() -> Self; fn ui_grey() -> Self; } impl CustomGreys for Color { - fn select_grey() -> Self { + fn selection_tail_grey() -> Self { Self::Indexed(242) } + fn secondary_selection_head_grey() -> Self { + Self::Indexed(246) + } + fn ui_grey() -> Self { Self::Indexed(238) }