From d2ce696d74c1389c8451b23478b4cdc2f1f8d2e9 Mon Sep 17 00:00:00 2001 From: phranck Date: Fri, 6 Feb 2026 21:10:54 +0100 Subject: [PATCH] Fix: Correct List selection and focus rendering - Selected items: dimmed background (20% opacity) + accent text (NO dot) - Focused items: pulsing dot indicator (no background) - Unfocused items: plain text with padding - Selection and focus are now visually distinct - 618 tests passing --- Sources/TUIkit/Views/List.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Sources/TUIkit/Views/List.swift b/Sources/TUIkit/Views/List.swift index 623f089..835205f 100644 --- a/Sources/TUIkit/Views/List.swift +++ b/Sources/TUIkit/Views/List.swift @@ -373,17 +373,18 @@ extension List: Renderable { context: RenderContext, palette: Palette ) -> String { - // Selection: background bar (full width) + // Selected: dimmed background, accent text (no dot, full width bar) if isSelected { - let selectedBg = ANSIRenderer.colorize( + let dimmedBg = palette.accent.opacity(0.2) + let selectedRow = ANSIRenderer.colorize( rowText, - foreground: palette.background, - background: palette.accent + foreground: palette.accent, + background: dimmedBg ) - return selectedBg + return selectedRow } - // Focused but not selected: simple text with pulsing dot prefix + // Focused but not selected: pulsing dot indicator if isFocused { let dimAccent = palette.accent.opacity(0.35) let dotColor = Color.lerp(dimAccent, palette.accent, phase: context.pulsePhase) @@ -391,7 +392,7 @@ extension List: Renderable { return styledDot + " " + rowText } - // Unfocused and not selected: just text + // Unfocused and not selected: just text with padding return " " + rowText } }