Просмотр исходного кода

feat(tui): theme override with OPENCODE_THEME

adamelmore 7 месяцев назад
Родитель
Сommit
bb17d14665
2 измененных файлов с 5 добавлено и 2 удалено
  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
-
 	app_, err := app.New(ctx, version, appInfo, modes, httpClient, model, prompt, mode)
 	if err != nil {
 		panic(err)
@@ -79,7 +78,6 @@ func main() {
 	program := tea.NewProgram(
 		tui.NewModel(app_),
 		tea.WithAltScreen(),
-		// tea.WithKeyboardEnhancements(),
 		tea.WithMouseCellMotion(),
 	)
 

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

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