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.
This commit is contained in:
Ed Zynda
2026-02-26 12:53:47 +03:00
parent ee5f41764b
commit a2c8201ec4
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -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
+1
View File
@@ -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),
)