From 61b605e724eb4cc50ab831534fcdd18e031d68eb Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Mon, 28 Apr 2025 08:46:09 -0500 Subject: feat: themes --- internal/app/app.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'internal/app') diff --git a/internal/app/app.go b/internal/app/app.go index 5438633d1..db2ce7da7 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -16,6 +16,7 @@ import ( "github.com/opencode-ai/opencode/internal/message" "github.com/opencode-ai/opencode/internal/permission" "github.com/opencode-ai/opencode/internal/session" + "github.com/opencode-ai/opencode/internal/tui/theme" ) type App struct { @@ -49,6 +50,9 @@ func New(ctx context.Context, conn *sql.DB) (*App, error) { LSPClients: make(map[string]*lsp.Client), } + // Initialize theme based on configuration + app.initTheme() + // Initialize LSP clients in the background go app.initLSPClients(ctx) @@ -73,6 +77,21 @@ func New(ctx context.Context, conn *sql.DB) (*App, error) { return app, nil } +// initTheme sets the application theme based on the configuration +func (app *App) initTheme() { + cfg := config.Get() + if cfg == nil || cfg.TUI.Theme == "" { + return // Use default theme + } + + // Try to set the theme from config + err := theme.SetTheme(cfg.TUI.Theme) + if err != nil { + logging.Warn("Failed to set theme from config, using default theme", "theme", cfg.TUI.Theme, "error", err) + } else { + logging.Debug("Set theme from config", "theme", cfg.TUI.Theme) + } +} // Shutdown performs a clean shutdown of the application func (app *App) Shutdown() { -- cgit v1.2.3