Skip to main content

Themes

Themes control the visual appearance of the opencode terminal user interface (TUI). They define colors for panels, text, syntax highlighting, diffs, buttons, status bars, and other UI elements.

Setting a Theme

Themes are configured in tui.json, the TUI-specific configuration file.

{
"$schema": "https://opencode.ai/tui.json",
"theme": "tokyonight"
}

The theme field accepts a theme name string. This can be one of the built-in themes or a custom theme you create.

Using OPENCODE_TUI_CONFIG

If you keep tui.json at a non-standard location, set the path via environment variable:

export OPENCODE_TUI_CONFIG=/path/to/custom/tui.json

Interactive Theme Selection

Via the TUI

Open the theme picker with:

/themes

Or use the keybinding: Ctrl+X then T

The theme picker shows all available themes with a live preview. Navigate with arrow keys and press Enter to apply a theme.

Via Keyboard Shortcut

If you have set up the themes keybinding:

{
"keybinds": {
"themes": "ctrl+x t"
}
}

Press Ctrl+X then T to cycle through or pick from available themes.

Built-in Themes

opencode ships with a curated set of built-in themes covering popular color schemes:

Theme NameStyleDescription
catppuccin-frappeDark, warmDefault theme. Soft, muted dark palette
catppuccin-latteLight, warmLight variant of Catppuccin
catppuccin-macchiatoDark, coolMedium-dark Catppuccin variant
catppuccin-mochaDark, richDeepest Catppuccin variant
tokyonightDark, blueBlue-tinted night theme
tokyonight-dayLightDaytime variant of Tokyonight
tokyonight-moonDark, purplePurple-tinted Tokyonight variant
tokyonight-stormDark, desaturatedMuted Tokyonight variant
draculaDark, purpleClassic Dracula color scheme
dracula-proDark, tunedEnhanced Dracula with refined colors
nordDark, arcticPolar blue-gray palette
nord-lightLight, arcticLight variant of Nord
gruvboxDark, retroRetro groove color scheme
gruvbox-lightLight, retroLight variant of Gruvbox
monokaiDark, vibrantClassic Monokai color scheme
monokai-proDark, refinedMonokai Pro with improved contrast
solarized-darkDark, earthEthan Schoonover's Solarized dark
solarized-lightLight, earthEthan Schoonover's Solarized light
one-darkDark, atomAtom editor's One Dark theme
one-lightLight, cleanAtom editor's One Light theme
github-darkDark, blueGitHub's dark theme
github-lightLight, cleanGitHub's light theme
everforestDark, greenGreen-tinted forest theme
everforest-lightLight, greenLight variant of Everforest
kanagawaDark, inkInspired by the Kanagawa wave painting
kanagawa-lotusLight, inkLight variant of Kanagawa
rose-pineDark, roseRosé pine with warm tones
rose-pine-dawnLight, roseLight variant of Rosé Pine
rose-pine-moonDark, mutedMuted variant of Rosé Pine

To list all available themes from the CLI:

opencode themes list

Custom Themes

Create your own theme by placing a JSON file in the themes directory.

Theme Locations

Themes can be placed in two locations:

  1. Project-level: .opencode/themes/ (in the project root)
  2. Global: ~/.config/opencode/themes/

The project-level directory takes precedence over the global directory.

Theme File Format

Theme files are JSON with a specific structure of color tokens:

{
"name": "my-custom-theme",
"type": "dark",
"colors": {
"background": "#1a1b26",
"foreground": "#c0caf5",
"primary": "#7aa2f7",
"secondary": "#bb9af7",
"accent": "#f7768e",
"surface": "#24283b",
"surfaceAlt": "#1f2335",
"border": "#3b4261",
"selection": "#33467c",
"selectionText": "#c0caf5",
"lineNumbers": "#3b4261",
"cursor": "#c0caf5",
"error": "#db4b4b",
"warning": "#e0af68",
"info": "#7dcfff",
"success": "#9ece6a",
"muted": "#565f89"
},
"syntax": {
"keyword": "#bb9af7",
"string": "#9ece6a",
"number": "#ff9e64",
"function": "#7aa2f7",
"variable": "#c0caf5",
"constant": "#ff9e64",
"type": "#ff9e64",
"class": "#7dcfff",
"interface": "#7dcfff",
"comment": "#565f89",
"operator": "#89ddff",
"property": "#73daca",
"punctuation": "#c0caf5",
"parameter": "#c0caf5",
"regexp": "#b4f9f8",
"tag": "#f7768e",
"attribute": "#9ece6a"
},
"panels": {
"sidebar": {
"background": "#1f2335",
"foreground": "#c0caf5",
"activeItem": "#24283b",
"hoverItem": "#1a1b26"
},
"statusBar": {
"background": "#1a1b26",
"foreground": "#565f89",
"modeForeground": "#7aa2f7",
"border": "#3b4261"
},
"input": {
"background": "#1f2335",
"foreground": "#c0caf5",
"placeholder": "#565f89",
"border": "#3b4261",
"focusBorder": "#7aa2f7"
},
"diff": {
"inserted": {
"background": "#1b3b2b",
"foreground": "#9ece6a",
"border": "#3b5e4a"
},
"deleted": {
"background": "#3b1b1b",
"foreground": "#f7768e",
"border": "#5e3a3a"
},
"modified": {
"background": "#1b2b3b",
"foreground": "#7dcfff",
"border": "#3a4a5e"
}
},
"scrollbar": {
"thumb": "#3b4261",
"track": "#1a1b26",
"hoverThumb": "#4c5280"
}
}
}

Theme Color Tokens

Base Colors

TokenDescription
backgroundMain background color
foregroundPrimary text color
primaryPrimary accent color
secondarySecondary accent color
accentHighlight/accent color
surfaceCard/panel background
surfaceAltAlternating panel background
borderBorder color
selectionText selection background
selectionTextText selection foreground
cursorCursor color
errorError state color
warningWarning state color
infoInfo state color
successSuccess state color
mutedMuted/de-emphasized text color

Syntax Colors

TokenDescription
keywordLanguage keywords
stringString literals
numberNumeric literals
functionFunction names
variableVariable names
constantConstants
typeType annotations
classClass names
commentComments
operatorOperators
propertyObject properties
tagHTML/JSX tags
attributeHTML/JSX attributes

Theme Previews

To preview a theme without applying it permanently:

opencode theme preview tokyonight

This temporarily switches the theme for the current session. The change reverts when you restart opencode unless you update tui.json.

Theme Inheritance

Custom themes can inherit from built-in themes and override specific tokens:

{
"name": "my-tokyonight-mod",
"inherits": "tokyonight",
"colors": {
"accent": "#ff007f",
"primary": "#00ff7f"
}
}

The inherits field specifies a base theme. Any tokens defined in the custom theme override the base; undefined tokens are inherited as-is.

Theme Metadata

Optionally add metadata to your theme files:

{
"name": "my-custom-theme",
"type": "dark",
"author": "Your Name",
"description": "My custom theme for opencode",
"version": "1.0.0",
"license": "MIT"
}

Metadata fields:

FieldDescription
nameTheme name (used in config and picker)
type"dark" or "light"
authorTheme author name
descriptionShort description of the theme
versionSemantic version string
licenseLicense identifier

Theme Directory Structure

~/.config/opencode/themes/
my-custom-theme.json
dracula-variant.json
.opencode/themes/
project-specific-theme.json

Each .json file in these directories registers as a selectable theme. The filename (without extension) becomes the theme identifier used in "theme": "...".

Persistent Theme

The theme set in tui.json persists across sessions. To make a theme permanent:

{
"theme": "tokyonight"
}

To always use a specific theme across all projects, set it in the global ~/.config/opencode/tui.json.