summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/layout/container.go
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-04-28 08:46:09 -0500
committeradamdottv <[email protected]>2025-04-30 07:46:34 -0500
commit61b605e724eb4cc50ab831534fcdd18e031d68eb (patch)
treeb15b074a8fed1931e179a8d3df08d05b753c7aa3 /internal/tui/layout/container.go
parent61d9dc95111d2645a49816f6d9d6cc1014be1a22 (diff)
downloadopencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.tar.gz
opencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.zip
feat: themes
Diffstat (limited to 'internal/tui/layout/container.go')
-rw-r--r--internal/tui/layout/container.go37
1 files changed, 8 insertions, 29 deletions
diff --git a/internal/tui/layout/container.go b/internal/tui/layout/container.go
index b92df5bb8..83aef5879 100644
--- a/internal/tui/layout/container.go
+++ b/internal/tui/layout/container.go
@@ -4,7 +4,7 @@ import (
"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
- "github.com/opencode-ai/opencode/internal/tui/styles"
+ "github.com/opencode-ai/opencode/internal/tui/theme"
)
type Container interface {
@@ -29,9 +29,6 @@ type container struct {
borderBottom bool
borderLeft bool
borderStyle lipgloss.Border
- borderColor lipgloss.TerminalColor
-
- backgroundColor lipgloss.TerminalColor
}
func (c *container) Init() tea.Cmd {
@@ -45,13 +42,12 @@ func (c *container) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (c *container) View() string {
+ t := theme.CurrentTheme()
style := lipgloss.NewStyle()
width := c.width
height := c.height
- // Apply background color if specified
- if c.backgroundColor != nil {
- style = style.Background(c.backgroundColor)
- }
+
+ style = style.Background(t.Background())
// Apply border if any side is enabled
if c.borderTop || c.borderRight || c.borderBottom || c.borderLeft {
@@ -69,11 +65,7 @@ func (c *container) View() string {
width--
}
style = style.Border(c.borderStyle, c.borderTop, c.borderRight, c.borderBottom, c.borderLeft)
-
- // Apply border color if specified
- if c.borderColor != nil {
- style = style.BorderBackground(c.backgroundColor).BorderForeground(c.borderColor)
- }
+ style = style.BorderBackground(t.Background()).BorderForeground(t.BorderNormal())
}
style = style.
Width(width).
@@ -132,11 +124,10 @@ func (c *container) BindingKeys() []key.Binding {
type ContainerOption func(*container)
func NewContainer(content tea.Model, options ...ContainerOption) Container {
+
c := &container{
- content: content,
- borderColor: styles.BorderColor,
- borderStyle: lipgloss.NormalBorder(),
- backgroundColor: styles.Background,
+ content: content,
+ borderStyle: lipgloss.NormalBorder(),
}
for _, option := range options {
@@ -201,12 +192,6 @@ func WithBorderStyle(style lipgloss.Border) ContainerOption {
}
}
-func WithBorderColor(color lipgloss.TerminalColor) ContainerOption {
- return func(c *container) {
- c.borderColor = color
- }
-}
-
func WithRoundedBorder() ContainerOption {
return WithBorderStyle(lipgloss.RoundedBorder())
}
@@ -218,9 +203,3 @@ func WithThickBorder() ContainerOption {
func WithDoubleBorder() ContainerOption {
return WithBorderStyle(lipgloss.DoubleBorder())
}
-
-func WithBackgroundColor(color lipgloss.TerminalColor) ContainerOption {
- return func(c *container) {
- c.backgroundColor = color
- }
-}