on main help sign in
chore(styles): create specific styles for image loading indicators
d6312f4Christian Rocha
internal/ui/chat/tools.go+7−6
@@ -623,12 +623,13 @@ func toolOutputImageContent(sty *styles.Styles, data, mediaType string) string {
623 dataSize := len(data) * 3 / 4
623 dataSize := len(data) * 3 / 4
624 sizeStr := formatSize(dataSize)
624 sizeStr := formatSize(dataSize)
625
625
626− loaded := sty.Base.Foreground(sty.Green).Render("Loaded")
627− arrow := sty.Base.Foreground(sty.GreenDark).Render("→")
628− typeStyled := sty.Base.Render(mediaType)
629− sizeStyled := sty.Subtle.Render(sizeStr)
630−
631− return sty.Tool.Body.Render(fmt.Sprintf("%s %s %s %s", loaded, arrow, typeStyled, sizeStyled))
626+ return sty.Tool.Body.Render(fmt.Sprintf(
627+ "%s %s %s %s",
628+ sty.Tool.ResourceLoadedText.String(),
629+ sty.Tool.ResourceLoadedIndicator.String(),
630+ sty.Base.Render(mediaType),
631+ sty.Subtle.Render(sizeStr),
632+ ))
632}
633}
633
634
634// getDigits returns the number of digits in a number.
635// getDigits returns the number of digits in a number.
internal/ui/styles/styles.go+12
@@ -321,6 +321,12 @@ type Styles struct {
321 MCPName lipgloss.Style // The mcp name
321 MCPName lipgloss.Style // The mcp name
322 MCPToolName lipgloss.Style // The mcp tool name
322 MCPToolName lipgloss.Style // The mcp tool name
323 MCPArrow lipgloss.Style // The mcp arrow icon
323 MCPArrow lipgloss.Style // The mcp arrow icon
324+
325+ // Images and external resources
326+ ResourceLoadedText lipgloss.Style
327+ ResourceLoadedIndicator lipgloss.Style
328+ ResourceSize lipgloss.Style
329+ MediaType lipgloss.Style
324 }
330 }
325
331
326 // Dialog styles
332 // Dialog styles
@@ -1168,6 +1174,12 @@ func DefaultStyles() Styles {
1168 s.Tool.MCPToolName = base.Foreground(blueDark)
1174 s.Tool.MCPToolName = base.Foreground(blueDark)
1169 s.Tool.MCPArrow = base.Foreground(blue).SetString(ArrowRightIcon)
1175 s.Tool.MCPArrow = base.Foreground(blue).SetString(ArrowRightIcon)
1170
1176
1177+ // Loading indicators for images, skills
1178+ s.Tool.ResourceLoadedText = base.Foreground(green).SetString("Loaded")
1179+ s.Tool.ResourceLoadedIndicator = base.Foreground(greenDark).SetString(ArrowRightIcon)
1180+ s.Tool.MediaType = base
1181+ s.Tool.ResourceSize = base.Foreground(fgMuted)
1182+
1171 // Buttons
1183 // Buttons
1172 s.ButtonFocus = lipgloss.NewStyle().Foreground(white).Background(secondary)
1184 s.ButtonFocus = lipgloss.NewStyle().Foreground(white).Background(secondary)
1173 s.ButtonBlur = s.Base.Background(bgSubtle)
1185 s.ButtonBlur = s.Base.Background(bgSubtle)