Themes
With OpenCode you can select from one of several built-in themes, use a theme that adapts to your terminal theme, or define your own custom theme.
By default, OpenCode uses our own opencode theme.
Terminal requirements
For themes to display correctly with their full color palette, your terminal must support truecolor (24-bit color). Most modern terminals support this by default, but you may need to enable it:
- Check support: run
echo $COLORTERM— it should outputtruecoloror24bit - Enable truecolor: set the environment variable
COLORTERM=truecolorin your shell profile - Terminal compatibility: ensure your terminal emulator supports 24-bit color (iTerm2, Alacritty, Kitty, Windows Terminal, and recent GNOME Terminal versions do)
Without truecolor support, themes may appear with reduced color accuracy or fall back to the nearest 256-color approximation.
Built-in themes
| Name | Description |
|---|---|
system | Adapts to your terminal’s background color |
tokyonight | Based on the Tokyonight theme |
everforest | Based on the Everforest theme |
ayu | Based on the Ayu dark theme |
catppuccin | Based on the Catppuccin theme |
catppuccin-macchiato | Based on the Catppuccin theme |
gruvbox | Based on the Gruvbox theme |
kanagawa | Based on the Kanagawa theme |
nord | Based on the Nord theme |
matrix | Hacker-style green on black theme |
one-dark | Based on the Atom One Dark theme |
System theme
The system theme automatically adapts to your terminal’s color scheme. Unlike fixed-color themes, it:
- Generates a gray scale based on your terminal’s background color, ensuring optimal contrast.
- Uses ANSI colors (0–15) for syntax highlighting and UI elements, respecting your terminal’s palette.
- Preserves terminal defaults, using
nonefor text and background colors.
Using a theme
Bring up the theme picker with the /theme command, or set it in tui.json:
{
"$schema": "https://opencode.ai/tui.json",
"theme": "tokyonight"
}
Custom themes
OpenCode supports a flexible JSON-based theme system.
Where themes are loaded from
Themes are loaded from multiple directories, in this order — later directories override earlier ones:
- Built-in themes — embedded in the binary
- User config directory —
~/.config/opencode/themes/*.json(or$XDG_CONFIG_HOME/opencode/themes/*.json) - Project root —
<project-root>/.opencode/themes/*.json - Current working directory —
./.opencode/themes/*.json
If two directories contain a theme with the same name, the higher-priority one wins.
Creating a theme
Create a JSON file in one of those directories:
mkdir -p ~/.config/opencode/themes
vim ~/.config/opencode/themes/my-theme.json
Or, for a project-specific theme:
mkdir -p .opencode/themes
vim .opencode/themes/my-theme.json
JSON format
Themes use a flexible JSON format that supports:
- Hex colors:
"#ffffff" - ANSI colors:
3(0–255) - Color references:
"primary"or your own definitions - Dark/light variants:
{"dark": "#000", "light": "#fff"} - No color:
"none"— uses the terminal’s default color or transparent
The optional defs section lets you define reusable colors that the theme references by name.
Terminal defaults
The special value "none" inherits the terminal’s default color, which is useful for themes that blend into your terminal’s color scheme:
"text": "none"— the terminal’s default foreground color"background": "none"— the terminal’s default background color
Example
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
"nord0": "#2E3440",
"nord1": "#3B4252",
"nord4": "#D8DEE9",
"nord7": "#8FBCBB",
"nord8": "#88C0D0",
"nord9": "#81A1C1",
"nord10": "#5E81AC",
"nord11": "#BF616A",
"nord12": "#D08770",
"nord14": "#A3BE8C"
},
"theme": {
"primary": { "dark": "nord8", "light": "nord10" },
"secondary": { "dark": "nord9", "light": "nord9" },
"accent": { "dark": "nord7", "light": "nord7" },
"error": { "dark": "nord11", "light": "nord11" },
"warning": { "dark": "nord12", "light": "nord12" },
"success": { "dark": "nord14", "light": "nord14" },
"info": { "dark": "nord8", "light": "nord10" },
"text": { "dark": "nord4", "light": "nord0" },
"textMuted": { "dark": "nord3", "light": "nord1" },
"background": { "dark": "nord0", "light": "#FFFFFF" },
"border": { "dark": "nord3", "light": "nord1" },
"borderSecondary": { "dark": "nord3", "light": "nord1" },
"successBorder": { "dark": "nord4", "light": "nord2" }
}
}