mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user