Compare commits

..
33 Commits
Author SHA1 Message Date
Dax Raad f8b78f08b4 add auto formatting and experimental hooks feature
publish / publish (push) Has been cancelled
2025-06-26 22:17:08 -04:00
Jay V a4f32d602b docs: lander tweak 2025-06-26 19:47:58 -04:00
Jay V dc3dd21cf3 docs: tweak lander 2025-06-26 19:02:44 -04:00
Dax Raad 8ca713b737 disable task tool temporarily
publish / publish (push) Has been cancelled
2025-06-26 18:27:49 -04:00
Jay V 5b54554fd5 docs: edit theme doc 2025-06-26 17:56:31 -04:00
Dax Raadandopencode 4bc651f958 fix: improve JSON formatting and add piped output support for run command
🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
2025-06-26 17:32:00 -04:00
Jay V 3b6976a9c8 Merge branch 'rekram1-node-chore/update-config-docs' into dev 2025-06-26 17:24:03 -04:00
Jay V 863d5c1e8e docs: editing rules 2025-06-26 17:23:52 -04:00
adamdottvandJay V 97e19e9677 fix(tui): editor styles were off 2025-06-26 17:22:21 -04:00
adamdottvandJay V b27851461f feat(tui): more themes 2025-06-26 17:22:21 -04:00
adamdottvandJay V 209687377a feat(tui): more themes 2025-06-26 17:22:21 -04:00
adamdottvandJay V 90face1c09 fix(tui): editor width issues 2025-06-26 17:22:21 -04:00
adamdottvandJay V 936e2ce48b feat(tui): show lsp diagnostics for edit and write tools 2025-06-26 17:22:21 -04:00
adamdottvandJay V 16ee8ee379 fix(tui): chat editor aesthetics 2025-06-26 17:22:21 -04:00
adamdottvandJay V ac39308dad fix(tui): visual issue with modal selected items in system theme 2025-06-26 17:22:21 -04:00
adamdottvandJay V 346b49219d chore: tui agents.md 2025-06-26 17:22:21 -04:00
Jay V d84c1f20c7 docs: social share 2025-06-26 17:22:17 -04:00
adamdottvandJay V dfb8777555 fix(tui): editor spinner colors 2025-06-26 17:21:53 -04:00
Jay V 008af18156 docs: share page responsive diff 2025-06-26 17:21:53 -04:00
adamdottvandJay V ab23167f80 docs: system theme 2025-06-26 17:21:53 -04:00
adamdottvandJay V b17ec46463 fix(tui): make opencode theme default 2025-06-26 17:21:53 -04:00
2e26b58d16 feat: default system theme (#419)
Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
2025-06-26 17:21:53 -04:00
Mike WallioandJay V 31b56e5a05 Fix undefined is not an object (evaluating 'G.title') (#395) 2025-06-26 17:21:53 -04:00
Juhani PelliandJay V 47c401cf25 fix: guard against large output limit causing infinite summarize loop (#399) 2025-06-26 17:21:53 -04:00
Dax RaadandJay V fab8dc9e6f more edit tool fixes 2025-06-26 17:21:53 -04:00
Dax RaadandJay V f39a2b1f16 integrate gemini-cli strategies for edit tool 2025-06-26 17:21:53 -04:00
Dax RaadandJay V 66830ced4e make edit tool more robust 2025-06-26 17:21:53 -04:00
Dax RaadandJay V 9d3fad754d ignore: typo 2025-06-26 17:21:53 -04:00
Dax RaadandJay V dcd3131f58 add output length errors 2025-06-26 17:21:53 -04:00
Dax RaadandJay V 3d02e07161 fix codex not working 2025-06-26 17:21:53 -04:00
Dax RaadandJay V 4dbc6a43a6 redirect uncaught errors to log file 2025-06-26 17:21:53 -04:00
adamdottv 5394b5188b fix(tui): editor styles were off
publish / publish (push) Has been cancelled
2025-06-26 15:12:26 -05:00
rekram1-node 9acc83697f chore: document AGENTS.md 2025-06-26 08:28:06 -05:00
15 changed files with 500 additions and 92 deletions
+13 -1
View File
@@ -1,3 +1,15 @@
{
"$schema": "https://opencode.ai/config.json"
"$schema": "https://opencode.ai/config.json",
"experimental": {
"hook": {
"file_edited": {
".json": []
},
"session_completed": [
{
"command": ["touch", "./node_modules/foo"]
}
]
}
}
}
+70
View File
@@ -183,6 +183,9 @@
"temperature": {
"type": "boolean"
},
"tool_call": {
"type": "boolean"
},
"cost": {
"type": "object",
"properties": {
@@ -223,6 +226,10 @@
},
"id": {
"type": "string"
},
"options": {
"type": "object",
"additionalProperties": {}
}
},
"additionalProperties": false
@@ -295,6 +302,69 @@
]
},
"description": "MCP (Model Context Protocol) server configurations"
},
"experimental": {
"type": "object",
"properties": {
"hook": {
"type": "object",
"properties": {
"file_edited": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"command"
],
"additionalProperties": false
}
}
},
"session_completed": {
"type": "array",
"items": {
"type": "object",
"properties": {
"command": {
"type": "array",
"items": {
"type": "string"
}
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": [
"command"
],
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
+2 -1
View File
@@ -1,6 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.0.5", "name": "opencode",
"version": "0.0.5",
"name": "opencode",
"type": "module",
"private": true,
"scripts": {
+14 -6
View File
@@ -79,6 +79,8 @@ export const RunCommand = cmd({
return
}
const isPiped = !process.stdout.isTTY
UI.empty()
UI.println(UI.logo())
UI.empty()
@@ -90,8 +92,8 @@ export const RunCommand = cmd({
await Session.share(session.id)
UI.println(
UI.Style.TEXT_INFO_BOLD +
"~ https://opencode.ai/s/" +
session.id.slice(-8),
"~ https://opencode.ai/s/" +
session.id.slice(-8),
)
}
UI.empty()
@@ -109,8 +111,8 @@ export const RunCommand = cmd({
UI.println(
color + `|`,
UI.Style.TEXT_NORMAL +
UI.Style.TEXT_DIM +
` ${type.padEnd(7, " ")}`,
UI.Style.TEXT_DIM +
` ${type.padEnd(7, " ")}`,
"",
UI.Style.TEXT_NORMAL + title,
)
@@ -134,7 +136,7 @@ export const RunCommand = cmd({
part.toolInvocation.toolName,
UI.Style.TEXT_INFO_BOLD,
]
printEvent(color, tool, metadata?.title || 'Unknown')
printEvent(color, tool, metadata?.title || "Unknown")
}
if (part.type === "text") {
@@ -147,7 +149,8 @@ export const RunCommand = cmd({
printEvent(UI.Style.TEXT_NORMAL_BOLD, "Text", part.text)
}
})
await Session.chat({
const result = await Session.chat({
sessionID: session.id,
providerID,
modelID,
@@ -158,6 +161,11 @@ export const RunCommand = cmd({
},
],
})
if (isPiped) {
const match = result.parts.findLast((x) => x.type === "text")
if (match) process.stdout.write(match.text)
}
UI.empty()
},
)
+26
View File
@@ -167,6 +167,32 @@ export namespace Config {
.record(z.string(), Mcp)
.optional()
.describe("MCP (Model Context Protocol) server configurations"),
experimental: z
.object({
hook: z
.object({
file_edited: z
.record(
z.string(),
z
.object({
command: z.string().array(),
environment: z.record(z.string(), z.string()).optional(),
})
.array(),
)
.optional(),
session_completed: z
.object({
command: z.string().array(),
environment: z.record(z.string(), z.string()).optional(),
})
.array()
.optional(),
})
.optional(),
})
.optional(),
})
.strict()
.openapi({
+143
View File
@@ -0,0 +1,143 @@
import { App } from '../app/app'
import { BunProc } from '../bun'
import { Config } from '../config/config'
import { Log } from '../util/log'
import path from 'path'
export namespace Format {
const log = Log.create({ service: 'format' })
const state = App.state('format', async () => {
const hooks: Record<string, Hook[]> = {}
for (const item of FORMATTERS) {
if (await item.enabled()) {
for (const ext of item.extensions) {
const list = hooks[ext] ?? []
list.push({
command: item.command,
environment: item.environment,
})
hooks[ext] = list
}
}
}
const cfg = await Config.get()
for (const [file, items] of Object.entries(
cfg.experimental?.hook?.file_edited ?? {},
)) {
for (const item of items) {
const list = hooks[file] ?? []
list.push({
command: item.command,
environment: item.environment,
})
hooks[file] = list
}
}
return {
hooks,
}
})
export async function run(file: string) {
log.info('formatting', { file })
const { hooks } = await state()
const ext = path.extname(file)
const match = hooks[ext]
if (!match) return
for (const item of match) {
log.info('running', { command: item.command })
const proc = Bun.spawn({
cmd: item.command.map((x) => x.replace('$FILE', file)),
cwd: App.info().path.cwd,
env: item.environment,
})
const exit = await proc.exited
if (exit !== 0)
log.error('failed', {
command: item.command,
...item.environment,
})
}
}
interface Hook {
command: string[]
environment?: Record<string, string>
}
interface Native {
name: string
command: string[]
environment?: Record<string, string>
extensions: string[]
enabled(): Promise<boolean>
}
const FORMATTERS: Native[] = [
{
name: 'prettier',
extensions: [
'.js',
'.jsx',
'.mjs',
'.cjs',
'.ts',
'.tsx',
'.mts',
'.cts',
'.html',
'.htm',
'.css',
'.scss',
'.sass',
'.less',
'.vue',
'.svelte',
'.json',
'.jsonc',
'.yaml',
'.yml',
'.toml',
'.xml',
'.md',
'.mdx',
'.php',
'.rb',
'.java',
'.go',
'.rs',
'.swift',
'.kt',
'.kts',
'.sol',
'.graphql',
'.gql',
],
command: [BunProc.which(), 'run', 'prettier', '--write', '$FILE'],
environment: {
BUN_BE_BUN: '1',
},
async enabled() {
try {
const proc = Bun.spawn({
cmd: [BunProc.which(), 'run', 'prettier', '--version'],
cwd: App.info().path.cwd,
env: {
BUN_BE_BUN: '1',
},
stdout: 'ignore',
stderr: 'ignore',
})
const exit = await proc.exited
return exit === 0
} catch {
return false
}
},
},
]
}
+1 -2
View File
@@ -23,7 +23,6 @@ import { AuthCopilot } from "../auth/copilot"
import { ModelsDev } from "./models"
import { NamedError } from "../util/error"
import { Auth } from "../auth"
import { TaskTool } from "../tool/task"
export namespace Provider {
const log = Log.create({ service: "provider" })
@@ -411,7 +410,7 @@ export namespace Provider {
// MultiEditTool,
WriteTool,
TodoWriteTool,
TaskTool,
// TaskTool,
TodoReadTool,
]
+11
View File
@@ -853,6 +853,17 @@ export namespace Session {
[Symbol.dispose]() {
log.info("unlocking", { sessionID })
state().pending.delete(sessionID)
Config.get().then((cfg) => {
if (cfg.experimental?.hook?.session_completed) {
for (const item of cfg.experimental.hook.session_completed) {
Bun.spawn({
cmd: item.command,
cwd: App.info().path.cwd,
env: item.environment,
})
}
}
})
},
}
}
+4 -1
View File
@@ -11,6 +11,7 @@ import { createTwoFilesPatch } from "diff"
import { Permission } from "../permission"
import DESCRIPTION from "./edit.txt"
import { App } from "../app/app"
import { Format } from "../format"
export const EditTool = Tool.define({
id: "edit",
@@ -59,6 +60,7 @@ export const EditTool = Tool.define({
if (params.oldString === "") {
contentNew = params.newString
await Bun.write(filepath, params.newString)
await Format.run(filepath)
return
}
@@ -77,6 +79,7 @@ export const EditTool = Tool.define({
params.replaceAll,
)
await file.write(contentNew)
await Format.run(filepath)
})()
const diff = trimDiff(
@@ -473,7 +476,7 @@ export function replace(
if (oldString === newString) {
throw new Error("oldString and newString must be different")
}
for (const replacer of [
SimpleReplacer,
LineTrimmedReplacer,
+2
View File
@@ -6,6 +6,7 @@ import { LSP } from "../lsp"
import { Permission } from "../permission"
import DESCRIPTION from "./write.txt"
import { App } from "../app/app"
import { Format } from "../format"
export const WriteTool = Tool.define({
id: "write",
@@ -42,6 +43,7 @@ export const WriteTool = Tool.define({
})
await Bun.write(filepath, params.content)
await Format.run(filepath)
FileTimes.read(ctx.sessionID, filepath)
let output = ""
@@ -6,6 +6,7 @@ import (
"github.com/charmbracelet/bubbles/v2/key"
"github.com/charmbracelet/bubbles/v2/textarea"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/lipgloss/v2"
"github.com/sst/opencode/internal/app"
"github.com/sst/opencode/internal/components/list"
"github.com/sst/opencode/internal/styles"
@@ -34,8 +35,7 @@ func (ci *CompletionItem) Render(selected bool, width int) string {
Padding(0, 1)
if selected {
itemStyle = itemStyle.
Foreground(t.Primary())
itemStyle = itemStyle.Foreground(t.Primary())
}
title := itemStyle.Render(
@@ -199,8 +199,14 @@ func (c *completionDialogComponent) View() string {
c.list.SetMaxWidth(maxWidth)
return baseStyle.Padding(0, 0).
return baseStyle.
Padding(0, 0).
Background(t.BackgroundElement()).
BorderStyle(lipgloss.ThickBorder()).
BorderLeft(true).
BorderRight(true).
BorderForeground(t.Border()).
BorderBackground(t.Background()).
Width(c.width).
Render(c.list.View())
}
+1
View File
@@ -73,6 +73,7 @@ export default defineConfig({
sidebar: [
"docs",
"docs/cli",
"docs/rules",
"docs/config",
"docs/models",
"docs/themes",
+47 -21
View File
@@ -19,8 +19,10 @@ const imageAttrs = {
const github = config.social.filter(s => s.icon === 'github')[0];
const command = "npm i -g";
const pkg = "opencode-ai";
const command = "curl -fsSL"
const protocol = "https://"
const url = "opencode.ai/install"
const bash = "| bash"
let darkImage: ImageMetadata | undefined;
let lightImage: ImageMetadata | undefined;
@@ -51,11 +53,13 @@ if (image) {
<section class="cta">
<div class="col1">
<a href="/docs">View the docs</a>
<a href="/docs">Docs</a>
</div>
<div class="col2">
<button class="command" data-command={`${command} ${pkg}`}>
<code>{command}&nbsp;<span class="highlight">{pkg}</span></code>
<button class="command" data-command={`${command} ${protocol}${url} ${bash}`}>
<code>
<span>{command}&nbsp;</span><span class="protocol">{protocol}</span><span class="highlight">{url}</span>&nbsp;{bash}
</code>
<span class="copy">
<CopyIcon />
<CheckIcon />
@@ -63,7 +67,7 @@ if (image) {
</button>
</div>
<div class="col3">
<a href={github.href}>Star on GitHub</a>
<a href={github.href}>GitHub</a>
</div>
</section>
@@ -133,39 +137,43 @@ section.top {
section.cta {
display: flex;
flex-direction: row;
justify-content: space-between;
justify-content: flex-start;
align-items: stretch;
border-top: 2px solid var(--sl-color-border);
@media (max-width: 40rem) {
@media (max-width: 50rem) {
flex-direction: column;
& > div.col1 { order: 1; }
& > div.col3 { order: 2; }
& > div.col2 { order: 3; }
}
& > div {
flex: 1;
line-height: 1.4;
padding: calc(var(--padding) / 2) 0.5rem;
@media (max-width: 40rem) {
padding-bottom: calc(var(--padding) / 2 + 4px);
}
padding: calc(var(--padding) / 2) 1rem;
a {
font-size: 1rem;
}
}
& > div.col2 {
@media (max-width: 50rem) {
flex: 0 0 auto;
}
}
& > div:not(.col2) {
& > div.col1, & > div.col3 {
flex: 1 1 auto;
text-align: center;
text-transform: uppercase;
@media (max-width: 50rem) {
padding-bottom: calc(var(--padding) / 2 + 4px);
}
}
& > div.col2 {
flex: 0 0 auto;
}
& > div + div {
border-left: 2px solid var(--sl-color-border);
@media (max-width: 40rem) {
@media (max-width: 50rem) {
border-left: none;
border-top: 2px solid var(--sl-color-border);
}
@@ -183,6 +191,21 @@ section.cta {
code {
color: var(--sl-color-text-secondary);
font-size: 1.125rem;
@media (max-width: 24rem) {
font-size: 0.875rem;
}
@media (max-width: 30rem) {
span.protocol {
display: none;
}
}
@media (max-width: 43rem) {
text-align: center;
span:first-child {
display: block;
}
}
}
code .highlight {
color: var(--sl-color-text);
@@ -192,6 +215,9 @@ section.cta {
.copy {
line-height: 1;
padding: 0;
@media (max-width: 43rem) {
display: none;
}
}
.copy svg {
width: 1rem;
@@ -0,0 +1,74 @@
---
title: Rules
---
You can provide custom instructions to opencode by creating an `AGENTS.md` file. This is similar to `CLAUDE.md` or Cursor's rules. It contains instructions that will be included in the LLM's context to customize its behavior for your specific project.
---
## Initialize
To create a new `AGENTS.md` file, you can run the `/init` command in opencode.
:::tip
You should commit your project's `AGENTS.md` file to Git.
:::
This will scan your project and all its contents to understand what the project is about and generate an `AGENTS.md` file with it. This helps opencode to navigate the project better.
If you have an existing `AGENTS.md` file, this will try to add to it.
---
## Example
You can also just create this file manually. Here's an example of some things you can put into an `AGENTS.md` file.
```markdown title="AGENTS.md"
# SST v3 Monorepo Project
This is an SST v3 monorepo with TypeScript. The project uses bun workspaces for package management.
## Project Structure
- `packages/` - Contains all workspace packages (functions, core, web, etc.)
- `infra/` - Infrastructure definitions split by service (storage.ts, api.ts, web.ts)
- `sst.config.ts` - Main SST configuration with dynamic imports
## Code Standards
- Use TypeScript with strict mode enabled
- Shared code goes in `packages/core/` with proper exports configuration
- Functions go in `packages/functions/`
- Infrastructure should be split into logical files in `infra/`
## Monorepo Conventions
- Import shared modules using workspace names: `@my-app/core/example`
```
We are adding project-specific instructions here and this will be shared across your team.
---
## Types
opencode also supports reading the `AGENTS.md` file from multiple locations. And this serves different purposes.
### Project
The ones we have seen above, where the `AGENTS.md` is placed in the project root, are project-specific rules. These only apply when you are working in this directory or its sub-directories.
### Global
You can also have global rules in a `~/.config/opencode/AGENTS.md` file. This gets applied across all opencode sessions.
Since this isn't committed to Git or shared with your team, we recommend using this to specify any personal rules that the LLM should follow.
---
## Precedence
So when opencode starts, it looks for:
1. **Local files** by traversing up from the current directory
2. **Global file** by checking `~/.config/opencode/AGENTS.md`
If you have both global and project-specific rules, opencode will combine them together.
+83 -57
View File
@@ -2,34 +2,96 @@
title: 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.
---
## Built-in themes
opencode comes with several 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 |
| `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 |
And more, we are constantly adding new themes.
---
## System theme
The `system` theme is 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 for users who:
- Want opencode to match their terminal's appearance
- Use custom terminal color schemes
- Prefer a consistent look across all terminal applications
---
## Using a theme
You can select a theme by bringing up the theme select with the `/theme` command. Or you can specify it in your [config](/docs/config).
```json title="opencode.json" {3}
{
"$schema": "https://opencode.ai/config.json",
"theme": "tokyonight"
}
```
---
## Custom themes
opencode supports a flexible JSON-based theme system that allows users to create and customize themes easily.
## Theme Loading Hierarchy
### Hierarchy
Themes are loaded from multiple directories in the following order (later directories override earlier ones):
Themes are loaded from multiple directories in the following order where later directories override earlier ones:
1. **Built-in themes** - Embedded in the binary
2. **User config directory** - `~/.config/opencode/themes/*.json` (or `$XDG_CONFIG_HOME/opencode/themes/*.json`)
3. **Project root directory** - `<project-root>/.opencode/themes/*.json`
4. **Current working directory** - `./.opencode/themes/*.json`
1. **Built-in themes** - These are embedded in the binary
2. **User config directory** - Defined in `~/.config/opencode/themes/*.json` or `$XDG_CONFIG_HOME/opencode/themes/*.json`
3. **Project root directory** - Defined in the `<project-root>/.opencode/themes/*.json`
4. **Current working directory** - Defined in `./.opencode/themes/*.json`
If multiple directories contain a theme with the same name, the theme from the directory with higher priority will be used.
## Creating a Custom Theme
### Creating a theme
To create a custom theme, create a JSON file in one of the theme directories:
To create a custom theme, create a JSON file in one of the theme directories.
For user-wide themes:
```bash no-frame
# For user-wide themes
mkdir -p ~/.config/opencode/themes
vim ~/.config/opencode/themes/my-theme.json
```
# For project-specific themes
And for project-specific themes.
```bash no-frame
mkdir -p .opencode/themes
vim .opencode/themes/my-theme.json
```
## Theme JSON Format
### JSON format
Themes use a flexible JSON format with support for:
@@ -37,11 +99,13 @@ 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)
- **No color**: `"none"` - Uses the terminal's default color or transparent
### Example Theme
### Example
```json no-frame
Here's an example of a custom theme:
```json title="my-theme.json"
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
@@ -267,51 +331,13 @@ Themes use a flexible JSON format with support for:
}
```
### Color Definitions
### Color definitions
The `defs` section (optional) allows you to define reusable colors that can be referenced in the theme.
The `defs` section is optional and it allows you to define reusable colors that can be referenced in the theme.
### Using "none" for Terminal Defaults
### 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 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:
- `system` - Default theme that dynamically adapts to your terminal's background color
- `tokyonight` - Tokyonight theme
- `everforest` - Everforest theme
- `ayu` - Ayu dark theme
- `catppuccin` - Catppuccin theme
- `gruvbox` - Gruvbox theme
- `kanagawa` - Kanagawa theme
- `nord` - Nord theme
- `matrix` - Hacker-style green on black theme
- `one-dark` - Atom One Dark inspired theme
## Using a Theme
To use a theme, set it in your opencode configuration or select it from the theme dialog in the TUI.
```json title="opencode.json" {3}
{
"$schema": "https://opencode.ai/config.json",
"theme": "tokyonight"
}
```
- `"text": "none"` - Uses terminal's default foreground color
- `"background": "none"` - Uses terminal's default background color