@@ -522,35 +522,46 @@ func TestRenderLogEntryLineWidthConsistent(t *testing.T) {
522522 }
523523 }
524524
525-func TestRenderLogEntryBackgroundApplied(t *testing.T) {
525+func TestRenderLogEntryForegroundApplied(t *testing.T) {
526526 // Force color output in tests (lipgloss strips colors without TTY)
527527 lipgloss.SetColorProfile(termenv.TrueColor)
528528 defer lipgloss.SetColorProfile(termenv.Ascii) // Reset after test
529529
530- // Test that background styling is applied to ALL lines, not just the first
531- // Background color is applied via ANSI escape codes containing "48;" (background)
530+ // Test that foreground styling is applied to prefix (backgrounds removed for cleaner UI)
531+ // Foreground color is applied via ANSI escape codes containing "38;" (foreground)
532532 entry := LogEntry{
533533 Role: "assistant",
534- Content: "First line\nSecond line\nThird line",
534+ Content: "Test message",
535535 }
536536 maxWidth := 60
537537 lines := renderLogEntryImpl(entry, maxWidth, false)
538538
539- if len(lines) < 3 {
540- t.Fatalf("expected at least 3 lines, got %d", len(lines))
539+ if len(lines) < 2 {
540+ t.Fatalf("expected at least 2 lines (padding + content), got %d", len(lines))
541541 }
542542
543- // Every line must contain ANSI background escape code
544- // ANSI background codes use "48;" prefix (e.g., "\x1b[48;2;..." for RGB)
545- for i, line := range lines {
546- if !strings.Contains(line, "\x1b[") {
547- t.Errorf("line %d missing ANSI escape codes (no styling applied)\nline bytes: %v", i, []byte(line))
548- }
549- // Check for background specifically - "48;" indicates background color
550- if !strings.Contains(line, "48;") {
551- t.Errorf("line %d missing background color escape code (48;)\nline: %q", i, line)
543+ // Find the first non-empty line (skip padding line)
544+ var contentLine string
545+ for _, line := range lines {
546+ stripped := strings.TrimSpace(stripANSI(line))
547+ if stripped != "" {
548+ contentLine = line
549+ break
552550 }
553551 }
552+
553+ if contentLine == "" {
554+ t.Fatal("no content line found")
555+ }
556+
557+ // Content line should have ANSI foreground color for the prefix
558+ // ANSI foreground codes use "38;" prefix (e.g., "\x1b[38;2;..." for RGB)
559+ if !strings.Contains(contentLine, "\x1b[") {
560+ t.Error("content line missing ANSI escape codes (no styling applied)")
561+ }
562+ if !strings.Contains(contentLine, "38;") {
563+ t.Error("content line missing foreground color escape code (38;)")
564+ }
554565 }
555566
556567 func TestRenderLogEntryPaddingAllRoles(t *testing.T) {