Themes

wterm uses CSS custom properties for all visual styling, making it easy to switch between built-in themes or create your own.

On this site's homepage, Default follows your site theme: light, dark, or system. The greeting and interactive terminal use the same colors, including in fullscreen. Selecting Solarized, Monokai, or Light keeps that terminal preset independent of the site theme. This site-specific Default does not change the package's default dark palette described below.

The local shell workspace has an Appearance dialog with System, Dark, and Light choices and a 10–32 px font-size control. Settings apply to all panes and persist in the same browser. System follows OS changes; switching appearance preserves existing shells.

Using a Theme

React

Pass the theme name via the theme prop:

<Terminal theme="monokai" />

Vue

Same theme prop:

<Terminal theme="monokai" />

Svelte

Pass the theme name through the theme prop:

<Terminal theme="monokai" />

Vanilla JS

Add the theme class to the terminal element:

const term = new WTerm(document.getElementById("terminal"));
term.element.classList.add("theme-monokai");
await term.init();

Built-in Themes

Default

The default dark theme, inspired by VS Code's Dark+ palette.

PropertyValue
Background#1e1e1e
Foreground#d4d4d4
Cursor#aeafad

Solarized Dark

The classic Solarized Dark color scheme by Ethan Schoonover.

<Terminal theme="solarized-dark" />
PropertyValue
Background#002b36
Foreground#839496
Cursor#93a1a1

Monokai

Based on the Monokai color scheme.

<Terminal theme="monokai" />
PropertyValue
Background#272822
Foreground#f8f8f2
Cursor#f8f8f0

Light

A clean light theme inspired by Atom's One Light.

<Terminal theme="light" />
PropertyValue
Background#fafafa
Foreground#383a42
Cursor#526eff

Custom Themes

Create a custom theme by defining a CSS class that overrides the wterm custom properties:

.wterm.theme-tokyo-night {
  --term-bg: #1a1b26;
  --term-fg: #c0caf5;
  --term-cursor: #f7768e;

  --term-color-0: #15161e;
  --term-color-1: #f7768e;
  --term-color-2: #9ece6a;
  --term-color-3: #e0af68;
  --term-color-4: #7aa2f7;
  --term-color-5: #bb9af7;
  --term-color-6: #7dcfff;
  --term-color-7: #a9b1d6;
  --term-color-8: #414868;
  --term-color-9: #f7768e;
  --term-color-10: #9ece6a;
  --term-color-11: #e0af68;
  --term-color-12: #7aa2f7;
  --term-color-13: #bb9af7;
  --term-color-14: #7dcfff;
  --term-color-15: #c0caf5;
}

Then apply it the same way as a built-in theme:

<Terminal theme="tokyo-night" />

CSS Custom Properties Reference

PropertyDescription
--term-bgTerminal background color
--term-fgDefault text color
--term-cursorCursor color
--term-font-familyFont stack (default: Menlo, Consolas, DejaVu Sans Mono, Courier New, monospace)
--term-font-sizeFont size (default: 14px)
--term-line-heightLine height multiplier (default: 1.2)
--term-color-0 … --term-color-7Standard ANSI colors (black, red, green, yellow, blue, magenta, cyan, white)
--term-color-8 … --term-color-15Bright ANSI colors

Colors beyond the 16-color palette (indices 16–255 and true-color RGB) are computed by the renderer and do not use custom properties.

Updating host colors

Use wt.setThemeColors(colors) to update a running terminal's foreground, background, cursor, and 16 ANSI colors together. The method sets the corresponding CSS custom properties and forwards the defaults to a supporting core. It repaints live and retained rows without writing escape sequences, restarting the parser, or clearing application color overrides. Painting still respects synchronized output, hidden pages, and paused panes.

wt.setThemeColors({
  foreground: 0x383a42,
  background: 0xfafafa,
  cursor: 0x526fff,
  palette: [
    0x383a42, 0xe45649, 0x50a14f, 0xc18401,
    0x4078f2, 0xa626a4, 0x0184bc, 0xa0a1a7,
    0x4f525e, 0xe45649, 0x50a14f, 0xc18401,
    0x4078f2, 0xa626a4, 0x0184bc, 0xffffff,
  ],
});

TerminalThemeColors uses opaque integer RGB values from 0 to 0xffffff and exactly 16 palette entries; invalid values throw RangeError before changes are applied. Values are copied and can be set before init(). Indices 16–255 and explicit RGB cell colors are unchanged. Application overrides take precedence; OSC resets return to the latest host defaults. The inline properties set by this method take precedence over theme classes; call it again to change those colors. Pass null to remove them and return to the CSS theme.

With Ghostty, use the updated bundled WASM asset to synchronize indexed colors and foreground/background query replies. Older WASM assets retain their existing engine defaults. Custom cores may implement the optional TerminalCore.setThemeColors() hook; without it only the CSS defaults update. Framework users can call the same method on the WTerm instance from onReady or their imperative handle's instance.

Application color changes

Ghostty applications can set the default foreground, background, and cursor colors with OSC 10, 11, and 12. OSC 110, 111, and 112 reset the corresponding color to the current CSS theme, including theme changes made while an override was active. Explicit SGR cell colors are unaffected. Inverse cells swap the actual foreground/background, including default colors, in both cores.

Application overrides are separate from --term-fg, --term-bg, and --term-cursor; the renderer never overwrites these host theme properties. Updates follow normal rendering, including synchronized output and paused panes. Destroying the terminal removes its overrides. The built-in core and older Ghostty WASM binaries retain CSS theme defaults.

Color queries

Applications ask for the default foreground and background with OSC 10 and 11 (printf '\e]11;?\a'). Both cores answer with the colors the terminal element's CSS resolves to when the query arrives: --term-fg and --term-bg, including theme classes, prefers-color-scheme rules and colors written in any CSS color space. Replies end with the query's own terminator, BEL or ST. Each ? asks for the color at its number, so OSC 10 ; ? ; ? returns the foreground and then the background.

Colors set with setThemeColors() take precedence until it is called with null. A Ghostty application's own OSC 10/11 color changes are reported until it resets them. The queries are recognized in the parsed output, so a query split across several write() calls, as PTY and WebSocket chunks can be, gets the same answer as one written whole. An OSC 10 or 11 sequence that sets a color instead of asking with ? is not a query and leaves the colors alone.

Headless Ghostty cores, which have no CSS, answer with their foregroundColor and backgroundColor options. See Ghostty options.

Dark and light reports

Applications such as Claude Code follow the terminal's color scheme with mode 2031. Both cores answer CSI ? 996 n with CSI ? 997 ; 1 n for a dark background or CSI ? 997 ; 2 n for a light one. While an application has CSI ? 2031 h set, setThemeColors() sends the new report through onData when the background crosses between dark and light. The host theme decides the scheme; an application's own OSC 11 color does not. When the query that notices a CSS theme change returns the background (CSI ? 996 n, OSC 11, or OSC 10 ; ? ; ?), the reply reports the new scheme and no separate CSI ? 997 report is sent. A query that returns only the foreground, such as OSC 10, leaves the scheme out, so the CSI ? 997 report goes out ahead of its reply. The same goes for an OSC 11 query that a Ghostty application's own background color answers: the reply carries that color, not the theme's, so the report still goes out.

Font and cell alignment

Choose a monospace font with --term-font-family and set its size with --term-font-size. wterm measures the font's cell width and uses it for text, backgrounds, and cursors. Braille, box drawing, and other fallback glyphs stay within their assigned columns even when the fallback font has wider glyphs. Wide characters occupy two cells; oversized glyphs are clipped to their cells. Common light, heavy, and rounded box-drawing characters connect across cell edges even when the font's glyphs fall short. They remain selectable as text.

Cell widths update when fonts load or the font size changes, including when autoResize is disabled. Native selection and OSC 8 link text are preserved. This behavior is shared by both cores and all framework components.

Cell backgrounds

Colored and reversed cells keep their backgrounds within their columns, including the last column and rows in scrollback. A complete row with one shared, opaque background extends that color to the container's right edge, keeping full-width status bars filled. Mixed, dim, or hidden cells do not repaint neighboring cells or other rows. This behavior is shared by both cores and all framework components.