diff options
| author | adamdottv <[email protected]> | 2025-04-28 08:46:09 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-04-30 07:46:34 -0500 |
| commit | 61b605e724eb4cc50ab831534fcdd18e031d68eb (patch) | |
| tree | b15b074a8fed1931e179a8d3df08d05b753c7aa3 /internal/tui/components/chat/chat.go | |
| parent | 61d9dc95111d2645a49816f6d9d6cc1014be1a22 (diff) | |
| download | opencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.tar.gz opencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.zip | |
feat: themes
Diffstat (limited to 'internal/tui/components/chat/chat.go')
| -rw-r--r-- | internal/tui/components/chat/chat.go | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/internal/tui/components/chat/chat.go b/internal/tui/components/chat/chat.go index f4c055903..ca094ca7c 100644 --- a/internal/tui/components/chat/chat.go +++ b/internal/tui/components/chat/chat.go @@ -9,6 +9,7 @@ import ( "github.com/opencode-ai/opencode/internal/config" "github.com/opencode-ai/opencode/internal/session" "github.com/opencode-ai/opencode/internal/tui/styles" + "github.com/opencode-ai/opencode/internal/tui/theme" "github.com/opencode-ai/opencode/internal/version" ) @@ -22,12 +23,29 @@ type SessionClearedMsg struct{} type EditorFocusMsg bool +func header(width int) string { + return lipgloss.JoinVertical( + lipgloss.Top, + logo(width), + repo(width), + "", + cwd(width), + ) +} + func lspsConfigured(width int) string { cfg := config.Get() title := "LSP Configuration" title = ansi.Truncate(title, width, "…") - lsps := styles.BaseStyle.Width(width).Foreground(styles.PrimaryColor).Bold(true).Render(title) + t := theme.CurrentTheme() + baseStyle := styles.BaseStyle() + + lsps := baseStyle. + Width(width). + Foreground(t.Primary()). + Bold(true). + Render(title) // Get LSP names and sort them for consistent ordering var lspNames []string @@ -39,16 +57,19 @@ func lspsConfigured(width int) string { var lspViews []string for _, name := range lspNames { lsp := cfg.LSP[name] - lspName := styles.BaseStyle.Foreground(styles.Forground).Render( - fmt.Sprintf("• %s", name), - ) + lspName := baseStyle. + Foreground(t.Text()). + Render(fmt.Sprintf("• %s", name)) + cmd := lsp.Command cmd = ansi.Truncate(cmd, width-lipgloss.Width(lspName)-3, "…") - lspPath := styles.BaseStyle.Foreground(styles.ForgroundDim).Render( - fmt.Sprintf(" (%s)", cmd), - ) + + lspPath := baseStyle. + Foreground(t.TextMuted()). + Render(fmt.Sprintf(" (%s)", cmd)) + lspViews = append(lspViews, - styles.BaseStyle. + baseStyle. Width(width). Render( lipgloss.JoinHorizontal( @@ -59,7 +80,8 @@ func lspsConfigured(width int) string { ), ) } - return styles.BaseStyle. + + return baseStyle. Width(width). Render( lipgloss.JoinVertical( @@ -75,10 +97,14 @@ func lspsConfigured(width int) string { func logo(width int) string { logo := fmt.Sprintf("%s %s", styles.OpenCodeIcon, "OpenCode") + t := theme.CurrentTheme() + baseStyle := styles.BaseStyle() - version := styles.BaseStyle.Foreground(styles.ForgroundDim).Render(version.Version) + versionText := baseStyle. + Foreground(t.TextMuted()). + Render(version.Version) - return styles.BaseStyle. + return baseStyle. Bold(true). Width(width). Render( @@ -86,34 +112,28 @@ func logo(width int) string { lipgloss.Left, logo, " ", - version, + versionText, ), ) } func repo(width int) string { repo := "https://github.com/opencode-ai/opencode" - return styles.BaseStyle. - Foreground(styles.ForgroundDim). + t := theme.CurrentTheme() + + return styles.BaseStyle(). + Foreground(t.TextMuted()). Width(width). Render(repo) } func cwd(width int) string { cwd := fmt.Sprintf("cwd: %s", config.WorkingDirectory()) - return styles.BaseStyle. - Foreground(styles.ForgroundDim). + t := theme.CurrentTheme() + + return styles.BaseStyle(). + Foreground(t.TextMuted()). Width(width). Render(cwd) } -func header(width int) string { - header := lipgloss.JoinVertical( - lipgloss.Top, - logo(width), - repo(width), - "", - cwd(width), - ) - return header -} |
