@@ -15,7 +15,6 @@ import (
1515 "github.com/opencode-ai/opencode/internal/llm/agent"
1616 "github.com/opencode-ai/opencode/internal/llm/tools"
1717 "github.com/opencode-ai/opencode/internal/tui/styles"
18- "github.com/opencode-ai/opencode/internal/tui/theme"
1918)
2019
2120// responseContextHeight limits the number of lines displayed in tool output
@@ -107,7 +106,7 @@ func (br baseRenderer) renderWithParams(v *toolCallCmp, toolName string, args []
107106 return joinHeaderBody (header , body )
108107}
109108
110- // unmarshalParams safely unmarshals JSON parameters
109+ // unmarshalParams safely unmarshal JSON parameters
111110func (br baseRenderer ) unmarshalParams (input string , target any ) error {
112111 return json .Unmarshal ([]byte (input ), target )
113112}
@@ -593,7 +592,7 @@ func joinHeaderBody(header, body string) string {
593592}
594593
595594func renderPlainContent (v * toolCallCmp , content string ) string {
596- t := theme .CurrentTheme ()
595+ t := styles .CurrentTheme ()
597596 content = strings .TrimSpace (content )
598597 lines := strings .Split (content , "\n " )
599598
@@ -606,58 +605,55 @@ func renderPlainContent(v *toolCallCmp, content string) string {
606605 if len (ln ) > v .textWidth () {
607606 ln = v .fit (ln , v .textWidth ())
608607 }
609- out = append (out , lipgloss . NewStyle () .
608+ out = append (out , t . S (). Muted .
610609 Width (v .textWidth ()).
611- Background (t .BackgroundSecondary ()).
612- Foreground (t .TextMuted ()).
610+ Background (t .BgSubtle ).
613611 Render (ln ))
614612 }
615613
616614 if len (lines ) > responseContextHeight {
617- out = append (out , lipgloss .NewStyle ().
618- Background (t .BackgroundSecondary ()).
619- Foreground (t .TextMuted ()).
615+ out = append (out , t .S ().Muted .
616+ Background (t .BgSubtle ).
620617 Render (fmt .Sprintf ("... (%d lines)" , len (lines )- responseContextHeight )))
621618 }
622619 return strings .Join (out , "\n " )
623620}
624621
625622func renderCodeContent (v * toolCallCmp , path , content string , offset int ) string {
626- t := theme .CurrentTheme ()
623+ t := styles .CurrentTheme ()
627624 truncated := truncateHeight (content , responseContextHeight )
628625
629- highlighted , _ := highlight .SyntaxHighlight (truncated , path , t .BackgroundSecondary () )
626+ highlighted , _ := highlight .SyntaxHighlight (truncated , path , t .BgSubtle )
630627 lines := strings .Split (highlighted , "\n " )
631628
632629 if len (strings .Split (content , "\n " )) > responseContextHeight {
633- lines = append (lines , lipgloss .NewStyle ().
634- Background (t .BackgroundSecondary ()).
635- Foreground (t .TextMuted ()).
630+ lines = append (lines , t .S ().Muted .
631+ Background (t .BgSubtle ).
636632 Render (fmt .Sprintf ("... (%d lines)" , len (strings .Split (content , "\n " ))- responseContextHeight )))
637633 }
638634
639635 for i , ln := range lines {
640- num := lipgloss . NewStyle () .
641- PaddingLeft ( 4 ). PaddingRight ( 2 ).
642- Background ( t . BackgroundSecondary () ).
643- Foreground ( t . TextMuted () ).
636+ num := t . S (). Muted .
637+ Background ( t . BgSubtle ).
638+ PaddingLeft ( 4 ).
639+ PaddingRight ( 2 ).
644640 Render (fmt .Sprintf ("%d" , i + 1 + offset ))
645641 w := v .textWidth () - lipgloss .Width (num )
646642 lines [i ] = lipgloss .JoinHorizontal (lipgloss .Left ,
647643 num ,
648- lipgloss . NewStyle () .
644+ t . S (). Base .
649645 Width (w ).
650- Background (t .BackgroundSecondary () ).
646+ Background (t .BgSubtle ).
651647 Render (v .fit (ln , w )))
652648 }
653649 return lipgloss .JoinVertical (lipgloss .Left , lines ... )
654650}
655651
656652func (v * toolCallCmp ) renderToolError () string {
657- t := theme .CurrentTheme ()
653+ t := styles .CurrentTheme ()
658654 err := strings .ReplaceAll (v .result .Content , "\n " , " " )
659655 err = fmt .Sprintf ("Error: %s" , err )
660- return styles . BaseStyle ().Foreground (t .Error () ).Render (v .fit (err , v .textWidth ()))
656+ return t . S ().Base . Foreground (t .Error ).Render (v .fit (err , v .textWidth ()))
661657}
662658
663659func removeWorkingDirPrefix (path string ) string {
0 commit comments