feat: themes

This commit is contained in:
adamdottv
2025-04-28 08:46:09 -05:00
parent 61d9dc9511
commit 61b605e724
35 changed files with 2797 additions and 1919 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/opencode-ai/opencode/internal/pubsub"
"github.com/opencode-ai/opencode/internal/tui/layout"
"github.com/opencode-ai/opencode/internal/tui/styles"
"github.com/opencode-ai/opencode/internal/tui/theme"
"github.com/opencode-ai/opencode/internal/tui/util"
)
@@ -61,7 +62,8 @@ func (i *tableCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (i *tableCmp) View() string {
return styles.ForceReplaceBackgroundWithLipgloss(i.table.View(), styles.Background)
t := theme.CurrentTheme()
return styles.ForceReplaceBackgroundWithLipgloss(i.table.View(), t.Background())
}
func (i *tableCmp) GetSize() (int, int) {
@@ -114,6 +116,7 @@ func (i *tableCmp) setRows() {
}
func NewLogsTable() TableComponent {
t := theme.CurrentTheme()
columns := []table.Column{
{Title: "ID", Width: 4},
{Title: "Time", Width: 4},
@@ -122,7 +125,7 @@ func NewLogsTable() TableComponent {
{Title: "Attributes", Width: 10},
}
defaultStyles := table.DefaultStyles()
defaultStyles.Selected = defaultStyles.Selected.Foreground(styles.Primary)
defaultStyles.Selected = defaultStyles.Selected.Foreground(t.Primary())
tableModel := table.New(
table.WithColumns(columns),
table.WithStyles(defaultStyles),