diff options
| author | Adam <[email protected]> | 2025-06-26 10:16:07 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-26 10:16:07 -0500 |
| commit | 7d13baadc84d7377a352c6d58ed9deeea2c918be (patch) | |
| tree | 575b6897431e390ae8bf4b9ccde2803446c6c67a /packages/web | |
| parent | db24bf87c01d3fff2a9594e55e9fab0d9ef52cfe (diff) | |
| download | opencode-7d13baadc84d7377a352c6d58ed9deeea2c918be.tar.gz opencode-7d13baadc84d7377a352c6d58ed9deeea2c918be.zip | |
feat: default system theme (#419)
Co-authored-by: adamdottv <[email protected]>
Diffstat (limited to 'packages/web')
| -rw-r--r-- | packages/web/public/theme.json | 20 | ||||
| -rw-r--r-- | packages/web/src/content/docs/docs/themes.mdx | 28 |
2 files changed, 45 insertions, 3 deletions
diff --git a/packages/web/public/theme.json b/packages/web/public/theme.json index e8e939ea8..0b1b95f02 100644 --- a/packages/web/public/theme.json +++ b/packages/web/public/theme.json @@ -22,6 +22,11 @@ "minimum": 0, "maximum": 255, "description": "ANSI color code (0-255)" + }, + { + "type": "string", + "enum": ["none"], + "description": "No color (uses terminal default)" } ] } @@ -112,6 +117,11 @@ }, { "type": "string", + "enum": ["none"], + "description": "No color (uses terminal default)" + }, + { + "type": "string", "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$", "description": "Reference to another color in the theme or defs" }, @@ -133,6 +143,11 @@ }, { "type": "string", + "enum": ["none"], + "description": "No color (uses terminal default)" + }, + { + "type": "string", "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$", "description": "Reference to another color for dark mode" } @@ -153,6 +168,11 @@ }, { "type": "string", + "enum": ["none"], + "description": "No color (uses terminal default)" + }, + { + "type": "string", "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$", "description": "Reference to another color for light mode" } diff --git a/packages/web/src/content/docs/docs/themes.mdx b/packages/web/src/content/docs/docs/themes.mdx index 487bcad32..436af67c3 100644 --- a/packages/web/src/content/docs/docs/themes.mdx +++ b/packages/web/src/content/docs/docs/themes.mdx @@ -2,7 +2,7 @@ title: Themes --- -opencode supports a flexible JSON-based theme system that allows users to create and customize themes easily. +opencode supports a flexible JSON-based theme system that allows users to create and customize themes easily. ## Theme Loading Hierarchy @@ -37,6 +37,7 @@ Themes use a flexible JSON format with support for: - **ANSI colors**: `3` (0-255) - **Color references**: `"primary"` or custom definitions - **Dark/light variants**: `{"dark": "#000", "light": "#fff"}` +- **No color**: `"none"` - Uses the terminal's default color (transparent) ### Example Theme @@ -270,10 +271,30 @@ Themes use a flexible JSON format with support for: The `defs` section (optional) allows you to define reusable colors that can be referenced in the theme. +### Using "none" for Terminal Defaults + +The special value `\"none\"` can be used for any color to inherit the terminal's default color. This is particularly useful for creating themes that blend seamlessly with your terminal's color scheme: + +- `\"text\": \"none\"` - Uses terminal's default foreground color +- `\"background\": \"none\"` - Uses terminal's default background color + +## The System Theme + +The `system` theme is opencode's default theme, designed to automatically adapt to your terminal's color scheme. Unlike traditional themes that use fixed colors, the system theme: + +- **Generates gray scale**: Creates a custom gray scale based on your terminal's background color, ensuring optimal contrast +- **Uses ANSI colors**: Leverages standard ANSI colors (0-15) for syntax highlighting and UI elements, which respect your terminal's color palette +- **Preserves terminal defaults**: Uses `none` for text and background colors to maintain your terminal's native appearance + +The system theme is ideal for users who: +- Want opencode to match their terminal's appearance +- Use custom terminal color schemes +- Prefer a consistent look across all terminal applications + ## Built-in Themes opencode comes with several built-in themes: -- `opencode` - Default opencode theme +- `system` - Default theme that dynamically adapts to your terminal's background color - `tokyonight` - Tokyonight theme - `everforest` - Everforest theme - `ayu` - Ayu dark theme @@ -281,7 +302,8 @@ opencode comes with several built-in themes: - `gruvbox` - Gruvbox theme - `kanagawa` - Kanagawa theme - `nord` - Nord theme -- and more (see ./packages/tui/internal/theme/themes) +- `matrix` - Hacker-style green on black theme +- `one-dark` - Atom One Dark inspired theme ## Using a Theme |
