Просмотр исходного кода

chore(tui): rename theme colors

adamdottv 8 месяцев назад
Родитель
Сommit
8b73c52f00

+ 15 - 15
packages/tui/internal/components/chat/message.go

@@ -137,7 +137,7 @@ func renderContentBlock(content string, options ...renderingOption) string {
 		PaddingBottom(renderer.paddingBottom).
 		PaddingLeft(renderer.paddingLeft).
 		PaddingRight(renderer.paddingRight).
-		Background(t.BackgroundSubtle()).
+		Background(t.BackgroundPanel()).
 		Foreground(t.TextMuted()).
 		BorderStyle(lipgloss.ThickBorder())
 
@@ -146,7 +146,7 @@ func renderContentBlock(content string, options ...renderingOption) string {
 		align = *renderer.align
 	}
 
-	borderColor := t.BackgroundSubtle()
+	borderColor := t.BackgroundPanel()
 	if renderer.borderColor != nil {
 		borderColor = *renderer.borderColor
 	}
@@ -159,7 +159,7 @@ func renderContentBlock(content string, options ...renderingOption) string {
 			AlignHorizontal(align).
 			BorderLeftForeground(borderColor).
 			BorderLeftBackground(t.Background()).
-			BorderRightForeground(t.BackgroundSubtle()).
+			BorderRightForeground(t.BackgroundPanel()).
 			BorderRightBackground(t.Background())
 	case lipgloss.Right:
 		style = style.
@@ -168,7 +168,7 @@ func renderContentBlock(content string, options ...renderingOption) string {
 			AlignHorizontal(align).
 			BorderRightForeground(borderColor).
 			BorderRightBackground(t.Background()).
-			BorderLeftForeground(t.BackgroundSubtle()).
+			BorderLeftForeground(t.BackgroundPanel()).
 			BorderLeftBackground(t.Background())
 	}
 
@@ -229,7 +229,7 @@ func renderText(message client.MessageInfo, text string, author string) string {
 	if message.Role == client.Assistant {
 		markdownWidth = width - padding - 4
 	}
-	content := toMarkdown(text, markdownWidth, t.BackgroundSubtle())
+	content := toMarkdown(text, markdownWidth, t.BackgroundPanel())
 	content = strings.Join([]string{content, info}, "\n")
 
 	switch message.Role {
@@ -274,7 +274,7 @@ func renderToolInvocation(
 	t := theme.CurrentTheme()
 	style := styles.Muted().
 		Width(outerWidth).
-		Background(t.BackgroundSubtle()).
+		Background(t.BackgroundPanel()).
 		PaddingTop(paddingTop).
 		PaddingBottom(paddingBottom).
 		PaddingLeft(2).
@@ -282,7 +282,7 @@ func renderToolInvocation(
 		BorderLeft(true).
 		BorderRight(true).
 		BorderBackground(t.Background()).
-		BorderForeground(t.BackgroundSubtle()).
+		BorderForeground(t.BackgroundPanel()).
 		BorderStyle(lipgloss.ThickBorder())
 
 	if toolCall.State == "partial-call" {
@@ -290,7 +290,7 @@ func renderToolInvocation(
 		if !showDetails {
 			title = "∟ " + title
 			padding := calculatePadding()
-			style := lipgloss.NewStyle().Width(outerWidth - padding - 4).Background(t.BackgroundSubtle())
+			style := lipgloss.NewStyle().Width(outerWidth - padding - 4).Background(t.BackgroundPanel())
 			return renderContentBlock(style.Render(title),
 				WithAlign(lipgloss.Left),
 				WithBorderColor(t.Accent()),
@@ -332,7 +332,7 @@ func renderToolInvocation(
 		if m, ok := metadata.Get("message"); ok {
 			style = style.BorderLeftForeground(t.Error())
 			error = styles.BaseStyle().
-				Background(t.BackgroundSubtle()).
+				Background(t.BackgroundPanel()).
 				Foreground(t.Error()).
 				Render(m.(string))
 			error = renderContentBlock(
@@ -374,7 +374,7 @@ func renderToolInvocation(
 				formattedDiff = lipgloss.NewStyle().
 					BorderStyle(lipgloss.ThickBorder()).
 					BorderBackground(t.Background()).
-					BorderForeground(t.BackgroundSubtle()).
+					BorderForeground(t.BackgroundPanel()).
 					BorderLeft(true).
 					BorderRight(true).
 					Render(formattedDiff)
@@ -410,7 +410,7 @@ func renderToolInvocation(
 			command := toolArgsMap["command"].(string)
 			stdout := stdout.(string)
 			body = fmt.Sprintf("```console\n> %s\n%s```", command, stdout)
-			body = toMarkdown(body, innerWidth, t.BackgroundSubtle())
+			body = toMarkdown(body, innerWidth, t.BackgroundPanel())
 			body = renderContentBlock(body, WithFullWidth(), WithMarginBottom(1))
 		}
 	case "webfetch":
@@ -421,7 +421,7 @@ func renderToolInvocation(
 				body = *result
 				body = truncateHeight(body, 10)
 				if format == "html" || format == "markdown" {
-					body = toMarkdown(body, innerWidth, t.BackgroundSubtle())
+					body = toMarkdown(body, innerWidth, t.BackgroundPanel())
 				}
 				body = renderContentBlock(body, WithFullWidth(), WithMarginBottom(1))
 			}
@@ -443,7 +443,7 @@ func renderToolInvocation(
 					body += fmt.Sprintf("- [ ] %s\n", content)
 				}
 			}
-			body = toMarkdown(body, innerWidth, t.BackgroundSubtle())
+			body = toMarkdown(body, innerWidth, t.BackgroundPanel())
 			body = renderContentBlock(body, WithFullWidth(), WithMarginBottom(1))
 		}
 	case "task":
@@ -503,7 +503,7 @@ func renderToolInvocation(
 	if !showDetails {
 		title = "∟ " + title
 		padding := calculatePadding()
-		style := lipgloss.NewStyle().Width(outerWidth - padding - 4).Background(t.BackgroundSubtle())
+		style := lipgloss.NewStyle().Width(outerWidth - padding - 4).Background(t.BackgroundPanel())
 		paddingBottom := 0
 		if isLast {
 			paddingBottom = 1
@@ -592,7 +592,7 @@ func renderFile(filename string, content string, options ...fileRenderingOption)
 		content = truncateHeight(content, renderer.height)
 	}
 	content = fmt.Sprintf("```%s\n%s\n```", extension(renderer.filename), content)
-	content = toMarkdown(content, width, t.BackgroundSubtle())
+	content = toMarkdown(content, width, t.BackgroundPanel())
 
 	return renderContentBlock(content, WithFullWidth(), WithMarginBottom(1))
 }

+ 5 - 5
packages/tui/internal/components/diff/diff.go

@@ -441,10 +441,10 @@ func SyntaxHighlight(w io.Writer, source, fileName, formatter string, bg color.C
 	<entry type="TextWhitespace" style="%s"/>
 </style>
 `,
-		getColor(t.BackgroundSubtle()), // Background
-		getColor(t.Text()),             // Text
-		getColor(t.Text()),             // Other
-		getColor(t.Error()),            // Error
+		getColor(t.BackgroundPanel()), // Background
+		getColor(t.Text()),            // Text
+		getColor(t.Text()),            // Other
+		getColor(t.Error()),           // Error
 
 		getColor(t.SyntaxKeyword()), // Keyword
 		getColor(t.SyntaxKeyword()), // KeywordConstant
@@ -614,7 +614,7 @@ func applyHighlighting(content string, segments []Segment, segmentType LineType,
 
 	// Get the appropriate color based on terminal background
 	bgColor := lipgloss.Color(getColor(highlightBg))
-	fgColor := lipgloss.Color(getColor(theme.CurrentTheme().BackgroundSubtle()))
+	fgColor := lipgloss.Color(getColor(theme.CurrentTheme().BackgroundPanel()))
 
 	for i := 0; i < len(content); {
 		// Check if we're at an ANSI sequence

+ 2 - 2
packages/tui/internal/components/status/status.go

@@ -88,7 +88,7 @@ func (m statusComponent) View() string {
 
 	cwd := styles.Padded().
 		Foreground(t.TextMuted()).
-		Background(t.BackgroundSubtle()).
+		Background(t.BackgroundPanel()).
 		Render(m.app.Info.Path.Cwd)
 
 	sessionInfo := ""
@@ -123,7 +123,7 @@ func (m statusComponent) View() string {
 		0,
 		m.width-lipgloss.Width(logo)-lipgloss.Width(cwd)-lipgloss.Width(sessionInfo),
 	)
-	spacer := lipgloss.NewStyle().Background(t.BackgroundSubtle()).Width(space).Render("")
+	spacer := lipgloss.NewStyle().Background(t.BackgroundPanel()).Width(space).Render("")
 
 	status := logo + cwd + spacer + sessionInfo
 

+ 4 - 4
packages/tui/internal/styles/styles.go

@@ -15,7 +15,7 @@ func BaseStyle() lipgloss.Style {
 func Panel() lipgloss.Style {
 	t := theme.CurrentTheme()
 	return lipgloss.NewStyle().
-		Background(t.BackgroundSubtle()).
+		Background(t.BackgroundPanel()).
 		Border(lipgloss.NormalBorder(), true, false, true, false).
 		BorderForeground(t.BorderSubtle()).
 		Foreground(t.Text())
@@ -131,9 +131,9 @@ func BackgroundColor() compat.AdaptiveColor {
 	return theme.CurrentTheme().Background()
 }
 
-// BackgroundSubtleColor returns the subtle background color from the current theme
-func BackgroundSubtleColor() compat.AdaptiveColor {
-	return theme.CurrentTheme().BackgroundSubtle()
+// BackgroundPanelColor returns the subtle background color from the current theme
+func BackgroundPanelColor() compat.AdaptiveColor {
+	return theme.CurrentTheme().BackgroundPanel()
 }
 
 // BackgroundElementColor returns the darker background color from the current theme

+ 1 - 1
packages/tui/internal/theme/ayu.go

@@ -98,7 +98,7 @@ func NewAyuTheme() *AyuTheme {
 		Dark:  lipgloss.Color(darkBg),
 		Light: lipgloss.Color(darkBg),
 	}
-	theme.BackgroundSubtleColor = compat.AdaptiveColor{
+	theme.BackgroundPanelColor = compat.AdaptiveColor{
 		Dark:  lipgloss.Color(darkBgAlt),
 		Light: lipgloss.Color(darkBgAlt),
 	}

+ 1 - 1
packages/tui/internal/theme/everforest.go

@@ -120,7 +120,7 @@ func NewEverforestTheme() *EverforestTheme {
 		Dark:  lipgloss.Color(darkStep1),
 		Light: lipgloss.Color(lightStep1),
 	}
-	theme.BackgroundSubtleColor = compat.AdaptiveColor{
+	theme.BackgroundPanelColor = compat.AdaptiveColor{
 		Dark:  lipgloss.Color(darkStep2),
 		Light: lipgloss.Color(lightStep2),
 	}

+ 1 - 1
packages/tui/internal/theme/manager.go

@@ -146,7 +146,7 @@ func LoadCustomTheme(customTheme map[string]any) (Theme, error) {
 		case "background":
 			theme.BackgroundColor = adaptiveColor
 		case "backgroundsubtle":
-			theme.BackgroundSubtleColor = adaptiveColor
+			theme.BackgroundPanelColor = adaptiveColor
 		case "backgroundelement":
 			theme.BackgroundElementColor = adaptiveColor
 		case "border":

+ 1 - 1
packages/tui/internal/theme/opencode.go

@@ -119,7 +119,7 @@ func NewOpenCodeTheme() *OpenCodeTheme {
 		Dark:  lipgloss.Color(darkStep1),
 		Light: lipgloss.Color(lightStep1),
 	}
-	theme.BackgroundSubtleColor = compat.AdaptiveColor{
+	theme.BackgroundPanelColor = compat.AdaptiveColor{
 		Dark:  lipgloss.Color(darkStep2),
 		Light: lipgloss.Color(lightStep2),
 	}

+ 3 - 3
packages/tui/internal/theme/theme.go

@@ -14,7 +14,7 @@ import (
 type Theme interface {
 	// Background colors
 	Background() compat.AdaptiveColor        // Radix 1
-	BackgroundSubtle() compat.AdaptiveColor  // Radix 2
+	BackgroundPanel() compat.AdaptiveColor   // Radix 2
 	BackgroundElement() compat.AdaptiveColor // Radix 3
 
 	// Border colors
@@ -84,7 +84,7 @@ type Theme interface {
 type BaseTheme struct {
 	// Background colors
 	BackgroundColor        compat.AdaptiveColor
-	BackgroundSubtleColor  compat.AdaptiveColor
+	BackgroundPanelColor   compat.AdaptiveColor
 	BackgroundElementColor compat.AdaptiveColor
 
 	// Border colors
@@ -163,7 +163,7 @@ func (t *BaseTheme) Text() compat.AdaptiveColor      { return t.TextColor }
 func (t *BaseTheme) TextMuted() compat.AdaptiveColor { return t.TextMutedColor }
 
 func (t *BaseTheme) Background() compat.AdaptiveColor        { return t.BackgroundColor }
-func (t *BaseTheme) BackgroundSubtle() compat.AdaptiveColor  { return t.BackgroundSubtleColor }
+func (t *BaseTheme) BackgroundPanel() compat.AdaptiveColor   { return t.BackgroundPanelColor }
 func (t *BaseTheme) BackgroundElement() compat.AdaptiveColor { return t.BackgroundElementColor }
 
 func (t *BaseTheme) Border() compat.AdaptiveColor       { return t.BorderColor }

+ 1 - 1
packages/tui/internal/theme/tokyonight.go

@@ -117,7 +117,7 @@ func NewTokyoNightTheme() *TokyoNightTheme {
 		Dark:  lipgloss.Color(darkStep1),
 		Light: lipgloss.Color(lightStep1),
 	}
-	theme.BackgroundSubtleColor = compat.AdaptiveColor{
+	theme.BackgroundPanelColor = compat.AdaptiveColor{
 		Dark:  lipgloss.Color(darkStep2),
 		Light: lipgloss.Color(lightStep2),
 	}