diff options
Diffstat (limited to 'packages/tui/internal/util')
| -rw-r--r-- | packages/tui/internal/util/color.go | 24 |
1 files changed, 23 insertions, 1 deletions
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 +} |
