Explorar el Código

feat(tui): theme override with OPENCODE_THEME

adamelmore hace 7 meses
padre
commit
bb17d14665
Se han modificado 2 ficheros con 5 adiciones y 2 borrados
  1. 0 2
      packages/tui/cmd/opencode/main.go
  2. 5 0
      packages/tui/internal/app/app.go

+ 0 - 2
packages/tui/cmd/opencode/main.go

@@ -70,7 +70,6 @@ func main() {
 	}()
 	}()
 
 
 	// Create main context for the application
 	// Create main context for the application
-
 	app_, err := app.New(ctx, version, appInfo, modes, httpClient, model, prompt, mode)
 	app_, err := app.New(ctx, version, appInfo, modes, httpClient, model, prompt, mode)
 	if err != nil {
 	if err != nil {
 		panic(err)
 		panic(err)
@@ -79,7 +78,6 @@ func main() {
 	program := tea.NewProgram(
 	program := tea.NewProgram(
 		tui.NewModel(app_),
 		tui.NewModel(app_),
 		tea.WithAltScreen(),
 		tea.WithAltScreen(),
-		// tea.WithKeyboardEnhancements(),
 		tea.WithMouseCellMotion(),
 		tea.WithMouseCellMotion(),
 	)
 	)
 
 

+ 5 - 0
packages/tui/internal/app/app.go

@@ -3,6 +3,7 @@ package app
 import (
 import (
 	"context"
 	"context"
 	"fmt"
 	"fmt"
+	"os"
 	"path/filepath"
 	"path/filepath"
 	"sort"
 	"sort"
 	"strings"
 	"strings"
@@ -103,6 +104,10 @@ func New(
 	if configInfo.Theme != "" {
 	if configInfo.Theme != "" {
 		appState.Theme = configInfo.Theme
 		appState.Theme = configInfo.Theme
 	}
 	}
+	themeEnv := os.Getenv("OPENCODE_THEME")
+	if themeEnv != "" {
+		appState.Theme = themeEnv
+	}
 
 
 	var modeIndex int
 	var modeIndex int
 	var mode *opencode.Mode
 	var mode *opencode.Mode