The open source coding agent.
TypeScript
feat: opencode theme (default)
adamdottv1e958b62ad0c
diff --git a/cmd/schema/main.go b/cmd/schema/main.goindex 805413ab1b4..4fea0348b31 100644--- a/cmd/schema/main.go+++ b/cmd/schema/main.go@@ -105,8 +105,8 @@ func generateSchema() map[string]any {"theme": map[string]any{"type": "string","description": "TUI theme name",- "default": "catppuccin",- "enum": []string{"catppuccin", "gruvbox", "flexoki", "onedark"},+ "default": "opencode",+ "enum": []string{"opencode", "catppuccin", "flexoki", "gruvbox", "monokai", "onedark"},},},}diff --git a/internal/config/config.go b/internal/config/config.goindex d7aa6071968..8d6ad39d83d 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 configcfg.TUI.Theme = themeName-+// Get the config file pathconfigFile := 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 fileconfigData, err := os.ReadFile(configFile)if err != nil {return fmt.Errorf("failed to read config file: %w", err)}-+// Parse the JSONvar 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 valuetuiConfig, ok := configMap["tui"].(map[string]interface{})if !ok {@@ -762,16 +762,16 @@ func UpdateTheme(themeName string) error {tuiConfig["theme"] = themeNameconfigMap["tui"] = tuiConfig}-+// Write the updated config back to fileupdatedData, 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}diff --git a/internal/tui/theme/manager.go b/internal/tui/theme/manager.goindex 161563c26b9..a81ba45c12d 100644--- a/internal/tui/theme/manager.go+++ b/internal/tui/theme/manager.go@@ -92,6 +92,11 @@ func AvailableThemes() []string {names = append(names, name)}slices.SortFunc(names, func(a, b string) int {+ if a == "opencode" {+ return -1+ } else if b == "opencode" {+ return 1+ }return strings.Compare(a, b)})return namesdiff --git a/internal/tui/theme/opencode.go b/internal/tui/theme/opencode.gonew file mode 100644index 00000000000..efec8615437--- /dev/null+++ b/internal/tui/theme/opencode.go@@ -0,0 +1,277 @@+package theme++import (+ "github.com/charmbracelet/lipgloss"+)++// OpenCodeTheme implements the Theme interface with OpenCode brand colors.+// It provides both dark and light variants.+type OpenCodeTheme struct {+ BaseTheme+}++// NewOpenCodeTheme creates a new instance of the OpenCode theme.+func NewOpenCodeTheme() *OpenCodeTheme {+ // OpenCode color palette+ // Dark mode colors+ darkBackground := "#212121"+ darkCurrentLine := "#252525"+ darkSelection := "#303030"+ darkForeground := "#e0e0e0"+ darkComment := "#6a6a6a"+ darkPrimary := "#fab283" // Primary orange/gold+ darkSecondary := "#5c9cf5" // Secondary blue+ darkAccent := "#9d7cd8" // Accent purple+ darkRed := "#e06c75" // Error red+ darkOrange := "#f5a742" // Warning orange+ darkGreen := "#7fd88f" // Success green+ darkCyan := "#56b6c2" // Info cyan+ darkYellow := "#e5c07b" // Emphasized text+ darkBorder := "#4b4c5c" // Border color++ // Light mode colors+ lightBackground := "#f8f8f8"+ lightCurrentLine := "#f0f0f0"+ lightSelection := "#e5e5e6"+ lightForeground := "#2a2a2a"+ lightComment := "#8a8a8a"+ lightPrimary := "#3b7dd8" // Primary blue+ lightSecondary := "#7b5bb6" // Secondary purple+ lightAccent := "#d68c27" // Accent orange/gold+ lightRed := "#d1383d" // Error red+ lightOrange := "#d68c27" // Warning orange+ lightGreen := "#3d9a57" // Success green+ lightCyan := "#318795" // Info cyan+ lightYellow := "#b0851f" // Emphasized text+ lightBorder := "#d3d3d3" // Border color++ theme := &OpenCodeTheme{}++ // Base colors+ theme.PrimaryColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.SecondaryColor = lipgloss.AdaptiveColor{+ Dark: darkSecondary,+ Light: lightSecondary,+ }+ theme.AccentColor = lipgloss.AdaptiveColor{+ Dark: darkAccent,+ Light: lightAccent,+ }++ // Status colors+ theme.ErrorColor = lipgloss.AdaptiveColor{+ Dark: darkRed,+ Light: lightRed,+ }+ theme.WarningColor = lipgloss.AdaptiveColor{+ Dark: darkOrange,+ Light: lightOrange,+ }+ theme.SuccessColor = lipgloss.AdaptiveColor{+ Dark: darkGreen,+ Light: lightGreen,+ }+ theme.InfoColor = lipgloss.AdaptiveColor{+ Dark: darkCyan,+ Light: lightCyan,+ }++ // Text colors+ theme.TextColor = lipgloss.AdaptiveColor{+ Dark: darkForeground,+ Light: lightForeground,+ }+ theme.TextMutedColor = lipgloss.AdaptiveColor{+ Dark: darkComment,+ Light: lightComment,+ }+ theme.TextEmphasizedColor = lipgloss.AdaptiveColor{+ Dark: darkYellow,+ Light: lightYellow,+ }++ // Background colors+ theme.BackgroundColor = lipgloss.AdaptiveColor{+ Dark: darkBackground,+ Light: lightBackground,+ }+ theme.BackgroundSecondaryColor = lipgloss.AdaptiveColor{+ Dark: darkCurrentLine,+ Light: lightCurrentLine,+ }+ theme.BackgroundDarkerColor = lipgloss.AdaptiveColor{+ Dark: "#121212", // Slightly darker than background+ Light: "#ffffff", // Slightly lighter than background+ }++ // Border colors+ theme.BorderNormalColor = lipgloss.AdaptiveColor{+ Dark: darkBorder,+ Light: lightBorder,+ }+ theme.BorderFocusedColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.BorderDimColor = lipgloss.AdaptiveColor{+ Dark: darkSelection,+ Light: lightSelection,+ }++ // Diff view colors+ theme.DiffAddedColor = lipgloss.AdaptiveColor{+ Dark: "#478247",+ Light: "#2E7D32",+ }+ theme.DiffRemovedColor = lipgloss.AdaptiveColor{+ Dark: "#7C4444",+ Light: "#C62828",+ }+ theme.DiffContextColor = lipgloss.AdaptiveColor{+ Dark: "#a0a0a0",+ Light: "#757575",+ }+ theme.DiffHunkHeaderColor = lipgloss.AdaptiveColor{+ Dark: "#a0a0a0",+ Light: "#757575",+ }+ theme.DiffHighlightAddedColor = lipgloss.AdaptiveColor{+ Dark: "#DAFADA",+ Light: "#A5D6A7",+ }+ theme.DiffHighlightRemovedColor = lipgloss.AdaptiveColor{+ Dark: "#FADADD",+ Light: "#EF9A9A",+ }+ theme.DiffAddedBgColor = lipgloss.AdaptiveColor{+ Dark: "#303A30",+ Light: "#E8F5E9",+ }+ theme.DiffRemovedBgColor = lipgloss.AdaptiveColor{+ Dark: "#3A3030",+ Light: "#FFEBEE",+ }+ theme.DiffContextBgColor = lipgloss.AdaptiveColor{+ Dark: darkBackground,+ Light: lightBackground,+ }+ theme.DiffLineNumberColor = lipgloss.AdaptiveColor{+ Dark: "#888888",+ Light: "#9E9E9E",+ }+ theme.DiffAddedLineNumberBgColor = lipgloss.AdaptiveColor{+ Dark: "#293229",+ Light: "#C8E6C9",+ }+ theme.DiffRemovedLineNumberBgColor = lipgloss.AdaptiveColor{+ Dark: "#332929",+ Light: "#FFCDD2",+ }++ // Markdown colors+ theme.MarkdownTextColor = lipgloss.AdaptiveColor{+ Dark: darkForeground,+ Light: lightForeground,+ }+ theme.MarkdownHeadingColor = lipgloss.AdaptiveColor{+ Dark: darkSecondary,+ Light: lightSecondary,+ }+ theme.MarkdownLinkColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.MarkdownLinkTextColor = lipgloss.AdaptiveColor{+ Dark: darkCyan,+ Light: lightCyan,+ }+ theme.MarkdownCodeColor = lipgloss.AdaptiveColor{+ Dark: darkGreen,+ Light: lightGreen,+ }+ theme.MarkdownBlockQuoteColor = lipgloss.AdaptiveColor{+ Dark: darkYellow,+ Light: lightYellow,+ }+ theme.MarkdownEmphColor = lipgloss.AdaptiveColor{+ Dark: darkYellow,+ Light: lightYellow,+ }+ theme.MarkdownStrongColor = lipgloss.AdaptiveColor{+ Dark: darkAccent,+ Light: lightAccent,+ }+ theme.MarkdownHorizontalRuleColor = lipgloss.AdaptiveColor{+ Dark: darkComment,+ Light: lightComment,+ }+ theme.MarkdownListItemColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.MarkdownListEnumerationColor = lipgloss.AdaptiveColor{+ Dark: darkCyan,+ Light: lightCyan,+ }+ theme.MarkdownImageColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.MarkdownImageTextColor = lipgloss.AdaptiveColor{+ Dark: darkCyan,+ Light: lightCyan,+ }+ theme.MarkdownCodeBlockColor = lipgloss.AdaptiveColor{+ Dark: darkForeground,+ Light: lightForeground,+ }++ // Syntax highlighting colors+ theme.SyntaxCommentColor = lipgloss.AdaptiveColor{+ Dark: darkComment,+ Light: lightComment,+ }+ theme.SyntaxKeywordColor = lipgloss.AdaptiveColor{+ Dark: darkSecondary,+ Light: lightSecondary,+ }+ theme.SyntaxFunctionColor = lipgloss.AdaptiveColor{+ Dark: darkPrimary,+ Light: lightPrimary,+ }+ theme.SyntaxVariableColor = lipgloss.AdaptiveColor{+ Dark: darkRed,+ Light: lightRed,+ }+ theme.SyntaxStringColor = lipgloss.AdaptiveColor{+ Dark: darkGreen,+ Light: lightGreen,+ }+ theme.SyntaxNumberColor = lipgloss.AdaptiveColor{+ Dark: darkAccent,+ Light: lightAccent,+ }+ theme.SyntaxTypeColor = lipgloss.AdaptiveColor{+ Dark: darkYellow,+ Light: lightYellow,+ }+ theme.SyntaxOperatorColor = lipgloss.AdaptiveColor{+ Dark: darkCyan,+ Light: lightCyan,+ }+ theme.SyntaxPunctuationColor = lipgloss.AdaptiveColor{+ Dark: darkForeground,+ Light: lightForeground,+ }++ return theme+}++func init() {+ // Register the OpenCode theme with the theme manager+ RegisterTheme("opencode", NewOpenCodeTheme())+}+diff --git a/opencode-schema.json b/opencode-schema.jsonindex 0fa94365647..277509f270e 100644--- a/opencode-schema.json+++ b/opencode-schema.json@@ -12,63 +12,63 @@"model": {"description": "Model ID for the agent","enum": [- "bedrock.claude-3.7-sonnet",- "gpt-4o-mini",- "gemini-2.0-flash",- "openrouter.o3",- "azure.gpt-4o",- "azure.gpt-4.1",+ "azure.o1",+ "azure.o4-mini",+ "openrouter.gpt-4.1-mini",+ "openrouter.claude-3.7-sonnet",+ "claude-3-haiku",+ "o3-mini",+ "gpt-4.1",+ "gpt-4o","openrouter.gemini-2.5",- "meta-llama/llama-4-maverick-17b-128e-instruct",+ "o3",+ "gemini-2.5-flash",+ "gemini-2.0-flash-lite",+ "openrouter.gpt-4.5-preview",+ "openrouter.o3-mini",+ "openrouter.claude-3-opus",+ "openrouter.o4-mini",+ "llama-3.3-70b-versatile",+ "azure.gpt-4.1","azure.o3-mini",+ "azure.o3",+ "gpt-4o-mini",+ "openrouter.gpt-4o",+ "claude-3.7-sonnet",+ "gemini-2.0-flash","azure.o1-mini",- "openrouter.gemini-2.5-flash",- "openrouter.gpt-4.1",- "claude-3.5-haiku",- "gemini-2.0-flash-lite",+ "openrouter.gpt-4o-mini",+ "openrouter.o1-mini",+ "o4-mini",+ "gemini-2.5",+ "qwen-qwq",+ "azure.gpt-4o-mini","azure.gpt-4.1-nano",- "openrouter.o1-pro",- "claude-3-haiku",- "deepseek-r1-distill-llama-70b",+ "bedrock.claude-3.7-sonnet",+ "o1-pro",+ "gpt-4.5-preview","gpt-4.1-mini",- "gpt-4.1",- "o3-mini",+ "openrouter.o1-pro",+ "claude-3.5-haiku","o1",- "gemini-2.5","openrouter.gpt-4.1-nano",- "azure.gpt-4.5-preview",- "gpt-4.5-preview",- "azure.o3",- "openrouter.o4-mini",- "openrouter.claude-3.7-sonnet",- "openrouter.gpt-4.5-preview",+ "openrouter.claude-3-haiku",+ "openrouter.claude-3.5-haiku",+ "openrouter.o3","claude-3-opus",- "o4-mini",- "o3",- "azure.o4-mini",- "azure.gpt-4.1-mini",- "gemini-2.5-flash",- "azure.gpt-4o-mini",- "openrouter.gpt-4o-mini",- "openrouter.gpt-4.1-mini",- "openrouter.gpt-4o",- "claude-3.5-sonnet",+ "openrouter.gemini-2.5-flash","o1-mini",- "openrouter.claude-3.5-haiku",- "openrouter.o3-mini",- "openrouter.claude-3-opus",- "o1-pro",- "qwen-qwq",- "meta-llama/llama-4-scout-17b-16e-instruct",+ "deepseek-r1-distill-llama-70b",+ "azure.gpt-4.5-preview",+ "openrouter.gpt-4.1",+ "meta-llama/llama-4-maverick-17b-128e-instruct","openrouter.claude-3.5-sonnet",- "claude-3.7-sonnet",- "gpt-4o",+ "claude-3.5-sonnet",+ "azure.gpt-4o",+ "azure.gpt-4.1-mini","openrouter.o1",- "openrouter.claude-3-haiku",- "azure.o1",- "llama-3.3-70b-versatile","gpt-4.1-nano",- "openrouter.o1-mini"+ "meta-llama/llama-4-scout-17b-16e-instruct"],"type": "string"},@@ -102,63 +102,63 @@"model": {"description": "Model ID for the agent","enum": [- "bedrock.claude-3.7-sonnet",- "gpt-4o-mini",- "gemini-2.0-flash",- "openrouter.o3",- "azure.gpt-4o",- "azure.gpt-4.1",+ "azure.o1",+ "azure.o4-mini",+ "openrouter.gpt-4.1-mini",+ "openrouter.claude-3.7-sonnet",+ "claude-3-haiku",+ "o3-mini",+ "gpt-4.1",+ "gpt-4o","openrouter.gemini-2.5",- "meta-llama/llama-4-maverick-17b-128e-instruct",+ "o3",+ "gemini-2.5-flash",+ "gemini-2.0-flash-lite",+ "openrouter.gpt-4.5-preview",+ "openrouter.o3-mini",+ "openrouter.claude-3-opus",+ "openrouter.o4-mini",+ "llama-3.3-70b-versatile",+ "azure.gpt-4.1","azure.o3-mini",+ "azure.o3",+ "gpt-4o-mini",+ "openrouter.gpt-4o",+ "claude-3.7-sonnet",+ "gemini-2.0-flash","azure.o1-mini",- "openrouter.gemini-2.5-flash",- "openrouter.gpt-4.1",- "claude-3.5-haiku",- "gemini-2.0-flash-lite",+ "openrouter.gpt-4o-mini",+ "openrouter.o1-mini",+ "o4-mini",+ "gemini-2.5",+ "qwen-qwq",+ "azure.gpt-4o-mini","azure.gpt-4.1-nano",- "openrouter.o1-pro",- "claude-3-haiku",- "deepseek-r1-distill-llama-70b",+ "bedrock.claude-3.7-sonnet",+ "o1-pro",+ "gpt-4.5-preview","gpt-4.1-mini",- "gpt-4.1",- "o3-mini",+ "openrouter.o1-pro",+ "claude-3.5-haiku","o1",- "gemini-2.5","openrouter.gpt-4.1-nano",- "azure.gpt-4.5-preview",- "gpt-4.5-preview",- "azure.o3",- "openrouter.o4-mini",- "openrouter.claude-3.7-sonnet",- "openrouter.gpt-4.5-preview",+ "openrouter.claude-3-haiku",+ "openrouter.claude-3.5-haiku",+ "openrouter.o3","claude-3-opus",- "o4-mini",- "o3",- "azure.o4-mini",- "azure.gpt-4.1-mini",- "gemini-2.5-flash",- "azure.gpt-4o-mini",- "openrouter.gpt-4o-mini",- "openrouter.gpt-4.1-mini",- "openrouter.gpt-4o",- "claude-3.5-sonnet",+ "openrouter.gemini-2.5-flash","o1-mini",- "openrouter.claude-3.5-haiku",- "openrouter.o3-mini",- "openrouter.claude-3-opus",- "o1-pro",- "qwen-qwq",- "meta-llama/llama-4-scout-17b-16e-instruct",+ "deepseek-r1-distill-llama-70b",+ "azure.gpt-4.5-preview",+ "openrouter.gpt-4.1",+ "meta-llama/llama-4-maverick-17b-128e-instruct","openrouter.claude-3.5-sonnet",- "claude-3.7-sonnet",- "gpt-4o",+ "claude-3.5-sonnet",+ "azure.gpt-4o",+ "azure.gpt-4.1-mini","openrouter.o1",- "openrouter.claude-3-haiku",- "azure.o1",- "llama-3.3-70b-versatile","gpt-4.1-nano",- "openrouter.o1-mini"+ "meta-llama/llama-4-scout-17b-16e-instruct"],"type": "string"},@@ -355,11 +355,15 @@"description": "Terminal User Interface configuration","properties": {"theme": {- "default": "catppuccin",+ "default": "opencode","description": "TUI theme name","enum": [+ "opencode","catppuccin",- "gruvbox"+ "flexoki",+ "gruvbox",+ "monokai",+ "onedark"],"type": "string"}