@@ -13,7 +13,6 @@ import (
13 "github.com/opencode-ai/opencode/internal/permission"
13 "github.com/opencode-ai/opencode/internal/permission"
14 "github.com/opencode-ai/opencode/internal/tui/layout"
14 "github.com/opencode-ai/opencode/internal/tui/layout"
15 "github.com/opencode-ai/opencode/internal/tui/styles"
15 "github.com/opencode-ai/opencode/internal/tui/styles"
16− "github.com/opencode-ai/opencode/internal/tui/theme"
17 "github.com/opencode-ai/opencode/internal/tui/util"
16 "github.com/opencode-ai/opencode/internal/tui/util"
@@ -149,28 +148,26 @@ func (p *permissionDialogCmp) selectCurrentOption() tea.Cmd {
151func (p *permissionDialogCmp) renderButtons() string {
150func (p *permissionDialogCmp) renderButtons() string {
152− t := theme.CurrentTheme()
151+ t := styles.CurrentTheme()
153− baseStyle := styles.BaseStyle()
155− allowStyle := baseStyle
153+ allowStyle := t.S().Text
156− allowSessionStyle := baseStyle
154+ allowSessionStyle := allowStyle
157− denyStyle := baseStyle
155+ denyStyle := allowStyle
158− spacerStyle := baseStyle.Background(t.Background())
160 // Style the selected button
157 // Style the selected button
161 switch p.selectedOption {
158 switch p.selectedOption {
163− allowStyle = allowStyle.Background(t.Primary()).Foreground(t.Background())
160+ allowStyle = allowStyle.Background(t.Primary)
164− allowSessionStyle = allowSessionStyle.Background(t.Background()).Foreground(t.Primary())
161+ allowSessionStyle = allowSessionStyle.Background(t.BgSubtle)
165− denyStyle = denyStyle.Background(t.Background()).Foreground(t.Primary())
162+ denyStyle = denyStyle.Background(t.BgSubtle)
167− allowStyle = allowStyle.Background(t.Background()).Foreground(t.Primary())
164+ allowStyle = allowStyle.Background(t.BgSubtle)
168− allowSessionStyle = allowSessionStyle.Background(t.Primary()).Foreground(t.Background())
165+ allowSessionStyle = allowSessionStyle.Background(t.Primary)
169− denyStyle = denyStyle.Background(t.Background()).Foreground(t.Primary())
166+ denyStyle = denyStyle.Background(t.BgSubtle)
171− allowStyle = allowStyle.Background(t.Background()).Foreground(t.Primary())
168+ allowStyle = allowStyle.Background(t.BgSubtle)
172− allowSessionStyle = allowSessionStyle.Background(t.Background()).Foreground(t.Primary())
169+ allowSessionStyle = allowSessionStyle.Background(t.BgSubtle)
173− denyStyle = denyStyle.Background(t.Primary()).Foreground(t.Background())
170+ denyStyle = denyStyle.Background(t.Primary)
176 allowButton := allowStyle.Padding(0, 1).Render("Allow (a)")
173 allowButton := allowStyle.Padding(0, 1).Render("Allow (a)")
@@ -180,33 +177,31 @@ func (p *permissionDialogCmp) renderButtons() string {
180 content := lipgloss.JoinHorizontal(
177 content := lipgloss.JoinHorizontal(
181 lipgloss.Left,
178 lipgloss.Left,
182 allowButton,
179 allowButton,
183− spacerStyle.Render(" "),
180+ " ",
184 allowSessionButton,
181 allowSessionButton,
185− spacerStyle.Render(" "),
182+ " ",
186 denyButton,
183 denyButton,
187− spacerStyle.Render(" "),
184+ " ",
190 remainingWidth := p.width - lipgloss.Width(content)
187 remainingWidth := p.width - lipgloss.Width(content)
191 if remainingWidth > 0 {
188 if remainingWidth > 0 {
192− content = spacerStyle.Render(strings.Repeat(" ", remainingWidth)) + content
189+ content = strings.Repeat(" ", remainingWidth) + content
194 return content
191 return content
197func (p *permissionDialogCmp) renderHeader() string {
194func (p *permissionDialogCmp) renderHeader() string {
198− t := theme.CurrentTheme()
195+ t := styles.CurrentTheme()
199− baseStyle := styles.BaseStyle()
196+ baseStyle := t.S().Base
201− toolKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("Tool")
198+ toolKey := t.S().Muted.Bold(true).Render("Tool")
202− toolValue := baseStyle.
199+ toolValue := t.S().Text.
203− Foreground(t.Text()).
204 Width(p.width - lipgloss.Width(toolKey)).
200 Width(p.width - lipgloss.Width(toolKey)).
205 Render(fmt.Sprintf(": %s", p.permission.ToolName))
201 Render(fmt.Sprintf(": %s", p.permission.ToolName))
207− pathKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("Path")
203+ pathKey := t.S().Muted.Bold(true).Render("Path")
208− pathValue := baseStyle.
204+ pathValue := t.S().Text.
209− Foreground(t.Text()).
210 Width(p.width - lipgloss.Width(pathKey)).
205 Width(p.width - lipgloss.Width(pathKey)).
211 Render(fmt.Sprintf(": %s", p.permission.Path))
206 Render(fmt.Sprintf(": %s", p.permission.Path))
@@ -228,12 +223,11 @@ func (p *permissionDialogCmp) renderHeader() string {
228 // Add tool-specific header information
223 // Add tool-specific header information
229 switch p.permission.ToolName {
224 switch p.permission.ToolName {
230 case tools.BashToolName:
225 case tools.BashToolName:
231− headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("Command"))
226+ headerParts = append(headerParts, t.S().Muted.Width(p.width).Bold(true).Render("Command"))
232 case tools.EditToolName:
227 case tools.EditToolName:
233 params := p.permission.Params.(tools.EditPermissionsParams)
228 params := p.permission.Params.(tools.EditPermissionsParams)
234− fileKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("File")
229+ fileKey := t.S().Muted.Bold(true).Render("File")
235− filePath := baseStyle.
230+ filePath := t.S().Text.
236− Foreground(t.Text()).
237 Width(p.width - lipgloss.Width(fileKey)).
231 Width(p.width - lipgloss.Width(fileKey)).
238 Render(fmt.Sprintf(": %s", params.FilePath))
232 Render(fmt.Sprintf(": %s", params.FilePath))
239 headerParts = append(headerParts,
233 headerParts = append(headerParts,
@@ -247,9 +241,8 @@ func (p *permissionDialogCmp) renderHeader() string {
248 case tools.WriteToolName:
242 case tools.WriteToolName:
249 params := p.permission.Params.(tools.WritePermissionsParams)
243 params := p.permission.Params.(tools.WritePermissionsParams)
250− fileKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("File")
244+ fileKey := t.S().Muted.Bold(true).Render("File")
251− filePath := baseStyle.
245+ filePath := t.S().Text.
252− Foreground(t.Text()).
253 Width(p.width - lipgloss.Width(fileKey)).
246 Width(p.width - lipgloss.Width(fileKey)).
254 Render(fmt.Sprintf(": %s", params.FilePath))
247 Render(fmt.Sprintf(": %s", params.FilePath))
255 headerParts = append(headerParts,
248 headerParts = append(headerParts,
@@ -261,15 +254,14 @@ func (p *permissionDialogCmp) renderHeader() string {
261 baseStyle.Render(strings.Repeat(" ", p.width)),
254 baseStyle.Render(strings.Repeat(" ", p.width)),
263 case tools.FetchToolName:
256 case tools.FetchToolName:
264− headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("URL"))
257+ headerParts = append(headerParts, t.S().Muted.Width(p.width).Bold(true).Render("URL"))
267− return lipgloss.NewStyle().Background(t.Background()).Render(lipgloss.JoinVertical(lipgloss.Left, headerParts...))
260+ return baseStyle.Render(lipgloss.JoinVertical(lipgloss.Left, headerParts...))
270func (p *permissionDialogCmp) renderBashContent() string {
263func (p *permissionDialogCmp) renderBashContent() string {
271− baseStyle := styles.BaseStyle()
264+ baseStyle := styles.CurrentTheme().S().Base
273 if pr, ok := p.permission.Params.(tools.BashPermissionsParams); ok {
265 if pr, ok := p.permission.Params.(tools.BashPermissionsParams); ok {
274 content := fmt.Sprintf("```bash\n%s\n```", pr.Command)
266 content := fmt.Sprintf("```bash\n%s\n```", pr.Command)
@@ -327,8 +319,7 @@ func (p *permissionDialogCmp) renderWriteContent() string {
329func (p *permissionDialogCmp) renderFetchContent() string {
321func (p *permissionDialogCmp) renderFetchContent() string {
330− baseStyle := styles.BaseStyle()
322+ baseStyle := styles.CurrentTheme().S().Base
332 if pr, ok := p.permission.Params.(tools.FetchPermissionsParams); ok {
323 if pr, ok := p.permission.Params.(tools.FetchPermissionsParams); ok {
333 content := fmt.Sprintf("```bash\n%s\n```", pr.URL)
324 content := fmt.Sprintf("```bash\n%s\n```", pr.URL)
@@ -349,7 +340,7 @@ func (p *permissionDialogCmp) renderFetchContent() string {
351func (p *permissionDialogCmp) renderDefaultContent() string {
342func (p *permissionDialogCmp) renderDefaultContent() string {
352− baseStyle := styles.BaseStyle()
343+ baseStyle := styles.CurrentTheme().S().Base
354 content := p.permission.Description
345 content := p.permission.Description
@@ -373,21 +364,19 @@ func (p *permissionDialogCmp) renderDefaultContent() string {
375func (p *permissionDialogCmp) styleViewport() string {
366func (p *permissionDialogCmp) styleViewport() string {
376− t := theme.CurrentTheme()
367+ t := styles.CurrentTheme()
377− contentStyle := lipgloss.NewStyle().
378− Background(t.Background())
380− return contentStyle.Render(p.contentViewPort.View())
369+ return t.S().Base.Render(p.contentViewPort.View())
383func (p *permissionDialogCmp) render() string {
372func (p *permissionDialogCmp) render() string {
384− t := theme.CurrentTheme()
373+ t := styles.CurrentTheme()
385− baseStyle := styles.BaseStyle()
374+ baseStyle := t.S().Base
387 title := baseStyle.
376 title := baseStyle.
388 Bold(true).
377 Bold(true).
389 Width(p.width - 4).
378 Width(p.width - 4).
390− Foreground(t.Primary()).
379+ Foreground(t.Primary).
391 Render("Permission Required")
380 Render("Permission Required")
392 // Render header
381 // Render header
393 headerContent := p.renderHeader()
382 headerContent := p.renderHeader()
@@ -428,8 +417,7 @@ func (p *permissionDialogCmp) render() string {
428 return baseStyle.
417 return baseStyle.
429 Padding(1, 0, 0, 1).
418 Padding(1, 0, 0, 1).
430 Border(lipgloss.RoundedBorder()).
419 Border(lipgloss.RoundedBorder()).
431− BorderBackground(t.Background()).
432− BorderForeground(t.TextMuted()).
420+ BorderForeground(t.BorderFocus).
433 Width(p.width).
421 Width(p.width).
434 Height(p.height).
422 Height(p.height).