@@ -20,7 +20,7 @@ mod tunnel_list;
2020
2121use ratatui:: Frame ;
2222use ratatui:: layout:: { Constraint , Layout , Rect } ;
23- use ratatui:: style:: Style ;
23+ use ratatui:: style:: { Modifier , Style } ;
2424use ratatui:: text:: { Line , Span } ;
2525use ratatui:: widgets:: Paragraph ;
2626use unicode_width:: UnicodeWidthStr ;
@@ -204,7 +204,11 @@ pub fn render(frame: &mut Frame, app: &mut App) {
204204fn render_overlay ( frame : & mut Frame , app : & mut App , f : impl FnOnce ( & mut Frame , & mut App ) ) {
205205 let status = app. status . take ( ) ;
206206
207- // Save host list buffer before overlay renders (needed for open animation clip restore)
207+ dim_background ( frame) ;
208+
209+ // Save dimmed host list buffer before overlay renders (needed for open
210+ // animation clip restore). Captured after dim so the background outside the
211+ // growing clip stays consistently dimmed during the animation.
208212 let progress = app. overlay_anim_progress ( ) ;
209213 let animating_open = progress. is_some ( ) ;
210214 let pre_overlay = if animating_open {
@@ -233,6 +237,33 @@ fn render_overlay(frame: &mut Frame, app: &mut App, f: impl FnOnce(&mut Frame, &
233237 app. status = status;
234238}
235239
240+ /// Dim all cells in the frame buffer so the host list behind an overlay appears muted.
241+ /// On truecolor/ANSI-16 terminals the foreground is replaced with dark grey for a
242+ /// stronger effect. Cells that already have a coloured background (badges, selected
243+ /// row) only receive the DIM modifier so their text stays readable.
244+ fn dim_background ( frame : & mut Frame ) {
245+ use ratatui:: style:: Color ;
246+
247+ let dim_only = Style :: default ( ) . add_modifier ( Modifier :: DIM ) ;
248+ let style = match theme:: color_mode ( ) {
249+ 2 => Style :: default ( )
250+ . fg ( Color :: Rgb ( 70 , 70 , 70 ) )
251+ . add_modifier ( Modifier :: DIM ) ,
252+ 1 => Style :: default ( )
253+ . fg ( Color :: DarkGray )
254+ . add_modifier ( Modifier :: DIM ) ,
255+ _ => dim_only,
256+ } ;
257+ let area = frame. area ( ) ;
258+ let buf = frame. buffer_mut ( ) ;
259+ for y in area. y ..area. y + area. height {
260+ for x in area. x ..area. x + area. width {
261+ let has_bg = buf[ ( x, y) ] . bg != Color :: Reset ;
262+ buf[ ( x, y) ] . set_style ( if has_bg { dim_only } else { style } ) ;
263+ }
264+ }
265+ }
266+
236267/// Render the close animation: paint saved overlay buffer with shrinking scale clip.
237268fn render_overlay_close ( frame : & mut Frame , app : & mut App ) {
238269 // Only run when a close animation is active
@@ -248,6 +279,10 @@ fn render_overlay_close(frame: &mut Frame, app: &mut App) {
248279
249280 if let Some ( ref saved) = app. overlay_buffer {
250281 if progress > 0.0 {
282+ // Dim the host list so the background stays consistently muted
283+ // while the overlay shrinks away.
284+ dim_background ( frame) ;
285+
251286 let area = frame. area ( ) ;
252287 let ( left, right, top, bottom) = scale_clip_rect ( area, progress) ;
253288
@@ -380,6 +415,9 @@ pub(crate) fn truncate(s: &str, max_cols: usize) -> String {
380415}
381416
382417/// Render a horizontal divider: ├─ Label ───────┤
418+ /// The `├` and `┤` connectors use the border style so they blend with the outer
419+ /// border. The horizontal `─` fill is rendered DIM to keep dividers visually
420+ /// subordinate to the border.
383421pub ( crate ) fn render_divider (
384422 frame : & mut Frame ,
385423 block_area : Rect ,
@@ -388,13 +426,16 @@ pub(crate) fn render_divider(
388426 label_style : Style ,
389427 border_style : Style ,
390428) {
429+ let dim = theme:: muted ( ) ;
391430 let width = block_area. width as usize ;
392431 let label_w = label. width ( ) ;
393432 let fill = width. saturating_sub ( 3 + label_w) ;
394433 let line = Line :: from ( vec ! [
395- Span :: styled( "├─" , border_style) ,
434+ Span :: styled( "├" , border_style) ,
435+ Span :: styled( "─" , dim) ,
396436 Span :: styled( label. to_string( ) , label_style) ,
397- Span :: styled( format!( "{}┤" , "─" . repeat( fill) ) , border_style) ,
437+ Span :: styled( "─" . repeat( fill) , dim) ,
438+ Span :: styled( "┤" , border_style) ,
398439 ] ) ;
399440 frame. render_widget (
400441 Paragraph :: new ( line) ,
0 commit comments