From a2c8201ec4cec17d094b8415f29d696bb353b375 Mon Sep 17 00:00:00 2001 From: Ed Zynda Date: Thu, 26 Feb 2026 12:53:47 +0300 Subject: [PATCH] fix(ui): add subtle background fill to user messages Use theme.Highlight (Catppuccin Surface 1) as a background color on user message blocks for visual distinction from agent messages. --- internal/ui/block_renderer.go | 13 +++++++++++++ internal/ui/messages.go | 1 + 2 files changed, 14 insertions(+) diff --git a/internal/ui/block_renderer.go b/internal/ui/block_renderer.go index d6eb4736..57d5df0f 100644 --- a/internal/ui/block_renderer.go +++ b/internal/ui/block_renderer.go @@ -10,6 +10,7 @@ import ( type blockRenderer struct { align *lipgloss.Position borderColor *color.Color + bgColor *color.Color fullWidth bool noBorder bool paddingTop int @@ -33,6 +34,14 @@ func WithFullWidth() renderingOption { } } +// WithBackground returns a renderingOption that sets a background color +// for the entire block. +func WithBackground(c color.Color) renderingOption { + return func(br *blockRenderer) { + br.bgColor = &c + } +} + // WithNoBorder returns a renderingOption that disables all borders on the // block, rendering content with only padding. func WithNoBorder() renderingOption { @@ -145,6 +154,10 @@ func renderContentBlock(content string, containerWidth int, options ...rendering PaddingRight(renderer.paddingRight). Foreground(theme.Text) + if renderer.bgColor != nil { + style = style.Background(*renderer.bgColor) + } + // Border width used for full-width calculation. borderChars := 0 diff --git a/internal/ui/messages.go b/internal/ui/messages.go index 58d1bb2d..b2d9e710 100644 --- a/internal/ui/messages.go +++ b/internal/ui/messages.go @@ -109,6 +109,7 @@ func (r *MessageRenderer) RenderUserMessage(content string, timestamp time.Time) r.width, WithAlign(lipgloss.Left), WithBorderColor(theme.Primary), + WithBackground(theme.Highlight), WithMarginBottom(1), )