From 1e958b62ad0c71331e8a45f7d19ad736ffa52d1c Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:20:41 -0500 Subject: feat: opencode theme (default) --- internal/config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index d7aa60719..8d6ad39d8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -210,7 +210,7 @@ func configureViper() { func setDefaults(debug bool) { viper.SetDefault("data.directory", defaultDataDirectory) viper.SetDefault("contextPaths", defaultContextPaths) - viper.SetDefault("tui.theme", "catppuccin") + viper.SetDefault("tui.theme", "opencode") if debug { viper.SetDefault("debug", true) @@ -731,7 +731,7 @@ func UpdateTheme(themeName string) error { // Update the in-memory config cfg.TUI.Theme = themeName - + // Get the config file path configFile := viper.ConfigFileUsed() if configFile == "" { @@ -739,19 +739,19 @@ func UpdateTheme(themeName string) error { viper.Set("tui.theme", themeName) return viper.SafeWriteConfig() } - + // Read the existing config file configData, err := os.ReadFile(configFile) if err != nil { return fmt.Errorf("failed to read config file: %w", err) } - + // Parse the JSON var configMap map[string]interface{} if err := json.Unmarshal(configData, &configMap); err != nil { return fmt.Errorf("failed to parse config file: %w", err) } - + // Update just the theme value tuiConfig, ok := configMap["tui"].(map[string]interface{}) if !ok { @@ -762,16 +762,16 @@ func UpdateTheme(themeName string) error { tuiConfig["theme"] = themeName configMap["tui"] = tuiConfig } - + // Write the updated config back to file updatedData, err := json.MarshalIndent(configMap, "", " ") if err != nil { return fmt.Errorf("failed to marshal config: %w", err) } - + if err := os.WriteFile(configFile, updatedData, 0644); err != nil { return fmt.Errorf("failed to write config file: %w", err) } - + return nil } -- cgit v1.2.3