From bd4319f2bc28c0ad16946107e7d1d50fa924527e Mon Sep 17 00:00:00 2001 From: spoons-and-mirrors <212802214+spoons-and-mirrors@users.noreply.github.com> Date: Sun, 10 Aug 2025 03:22:16 +0200 Subject: Feat: Add Agent Name in the LLM Response Footer (and re-order it) (#1770) --- packages/tui/internal/util/color.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'packages/tui/internal/util') diff --git a/packages/tui/internal/util/color.go b/packages/tui/internal/util/color.go index f0d73bcb2..b387ca655 100644 --- a/packages/tui/internal/util/color.go +++ b/packages/tui/internal/util/color.go @@ -3,6 +3,9 @@ package util import ( "regexp" "strings" + + "github.com/charmbracelet/lipgloss/v2/compat" + "github.com/sst/opencode/internal/theme" ) var csiRE *regexp.Regexp @@ -89,5 +92,24 @@ func ConvertRGBToAnsi16Colors(s string) string { // func looksLikeByte(tok string) bool { // v, err := strconv.Atoi(tok) -// return err == nil && v >= 0 && v <= 255 +// return err == nil && v >= 0 && v <= 255 // } + +// GetAgentColor returns the color for a given agent index, matching the status bar colors +func GetAgentColor(agentIndex int) compat.AdaptiveColor { + t := theme.CurrentTheme() + agentColors := []compat.AdaptiveColor{ + t.TextMuted(), + t.Secondary(), + t.Accent(), + t.Success(), + t.Warning(), + t.Primary(), + t.Error(), + } + + if agentIndex >= 0 && agentIndex < len(agentColors) { + return agentColors[agentIndex] + } + return t.Secondary() // default fallback +} -- cgit v1.2.3