DEV Community

DroidActor Dotori
DroidActor Dotori

Posted on

WezTerm Themes: One Line and Tab Colors

Google Play QR + Dotori Alarm Clock - Set each alarm's snooze schedule

A free app I built myself. Give it a try.

A fresh WezTerm install opens with gray text on a black background and a green cursor. With five or six tabs open, you look twice to see which one you are in. It is a window you keep open all day, yet its colors are still the install defaults.

This post is for Windows users who want to change how WezTerm looks. I copy the setup I actually use, the Catppuccin Macchiato theme with a bottom tab bar and a lavender border, and add popular themes and ideas from other people's configs. The short version: change the theme with one line, then match only the tab bar and border to it.

It covers five things. First, picking a theme with one color_scheme line, with a picture that compares nine popular themes on the same screen. Second, keeping the theme but changing a few colors such as the cursor. Third, moving the tab bar to the bottom and painting the window border in theme colors. Fourth, letting the theme follow Windows light and dark mode on its own. Last, other people's touches such as a translucent background.

My WezTerm screen - Catppuccin Macchiato theme, bottom tab bar, lavender border

This is WezTerm with the settings I use every day. The Catppuccin Macchiato theme gives a navy background, the window has a lavender border, and the tab bar sits at the bottom. The wave icon at the bottom left appears when the leader key Ctrl+U is pressed. The right pane is not selected, so WezTerm draws it slightly dimmer.

One line changes the theme

The WezTerm configuration file is .wezterm.lua in your home folder. On Windows that is C:\Users\<you>\.wezterm.lua, and I described creating it in the first post. Add one line with a theme name and save. WezTerm watches the file and reloads it the moment you save, so you do not need to restart the window.

The official docs say WezTerm ships with over 700 color schemes. I counted them in the version installed on my PC (build 20260331) and got 1,113. They come from collections such as iTerm2-Color-Schemes, base16, Gogh and terminal.sexy. The full list with previews is on the official Color Schemes page, grouped by first letter.

Here are the color and font parts of my configuration.

local wezterm = require("wezterm")
local config = wezterm.config_builder()

config.color_scheme = "Catppuccin Macchiato"
config.colors = {
  cursor_bg = "#61afef",
  cursor_border = "#61afef",
  cursor_fg = "#1e2127",
  scrollbar_thumb = "#5c6370",
}
config.font = wezterm.font("JetBrains Mono", { weight = "Light" })
config.font_size = 13

return config
Enter fullscreen mode Exit fullscreen mode

Type the theme name exactly as listed, including capitals and spaces. Many themes exist under several names. Dracula, for example, appears as Dracula, Dracula (Official), Dracula (Gogh) and Dracula (base16). The part in parentheses is the collection it came from, and the colors differ slightly between them.

Popular themes only need a name

I picked nine themes that often appear in WezTerm configs online and opened each one in WezTerm on my PC. Every screen shows the same output; only the theme changes. I used the kind of output you see every day: a file list, git history and code.

Nine WezTerm themes compared on the same screen

The name above each tile is the value you put in the configuration. The two rows of color bars at the top of each tile are the theme's 16 base colors, and every text color below comes from them. If the text looks small, open the comparison at full size.

Name in the configuration Background Character
Catppuccin Mocha #1e1e2e Soft pastel text. Latte, Frappe and Macchiato are in the same family
Tokyo Night #1a1b26 Strong blues and purples. Storm, Moon and Day variants exist
Dracula (Official) #282a36 Vivid pink and green
Gruvbox Dark (Gogh) #282828 Yellowish text (#ebdbb2) and warm colors
Nord (Gogh) #2e3440 Calm colors on a blue-gray background
rose-pine #191724 Deep indigo background
Kanagawa (Gogh) #1f1f28 Text with a parchment tint (#dcd7ba)
Synthwave (Gogh) #262335 Neon pink and sky blue. The flashiest of the nine
Monokai Pro (Gogh) #363537 Orange and yellow on dark gray

Catppuccin needs no extra install. Catppuccin's WezTerm page also says it is already included in WezTerm. The four flavors are written with the Catppuccin prefix, as in Catppuccin Frappe. The Macchiato I use is the second darkest, with a #24273a background.

Instead of deciding at once, try the names in the table one by one. Each save applies immediately, so you can compare three or four themes in a few minutes.

Keep the theme and change a few colors

Sometimes you like a theme except for one color, such as the cursor. Then list only the colors to change in config.colors, as in the code above. WezTerm applies the theme first and then overrides it with the colors in colors. My setup replaces Macchiato's pinkish cursor (#f4dbd6) with a One Dark style blue (#61afef) and makes the scrollbar thumb gray (#5c6370).

Older posts may say that color_scheme and colors cannot be used together. That was true before the September 2022 release (20220903). The official docs still show both the old and the new explanation, but overriding is how it works now.

For the font I use JetBrains Mono at Light weight, size 13. WezTerm bundles this font, so there is nothing to install. It also bundles the Nerd Font symbols used for tab bar arrows and a color emoji font. That is why symbols do not break even when you pick another font: WezTerm appends these default fonts after the one you choose.

Paint the tab bar and border in theme colors

I changed two things in the tab bar. use_fancy_tab_bar = false turns it into a simple bar that uses the terminal font. Adding tab_bar_at_bottom = true moves it to the bottom of the window. The command line usually sits near the bottom of the screen, so tab names there need less eye movement.

Tab colors follow the theme even if you set nothing. The built-in Catppuccin Macchiato already defines a #181926 tab bar background and a lavender-purple (#c6a0f6) active tab with dark text. My setup uses format-tab-title for the titles, not for the colors. It numbers tabs from 1 and adds [H] to tabs running Herdr. The code below keeps only the numbering and uses the same colors as the theme.

The window border is different. The theme has no border color, so I took lavender (#b7bdf8) from the official Catppuccin palette. Paste the code below just above return config in the earlier code.

local palette = {
  mauve = "#c6a0f6",
  lavender = "#b7bdf8",
  crust = "#181926",
}

config.window_frame = {
  border_left_width = "0.2cell",
  border_right_width = "0.2cell",
  border_bottom_height = "0.1cell",
  border_top_height = "0.1cell",
  border_left_color = palette.lavender,
  border_right_color = palette.lavender,
  border_bottom_color = palette.lavender,
  border_top_color = palette.lavender,
}

config.use_fancy_tab_bar = false
config.tab_bar_at_bottom = true

wezterm.on("format-tab-title", function(tab, tabs, panes, cfg, hover, max_width)
  local title = " " .. (tab.tab_index + 1) .. ": " .. tab.active_pane.title .. " "
  if tab.is_active then
    return {
      { Background = { Color = palette.mauve } },
      { Foreground = { Color = palette.crust } },
      { Text = title },
    }
  end
  return wezterm.truncate_right(title, max_width)
end)
Enter fullscreen mode Exit fullscreen mode

0.2cell means one fifth of a character cell, so the border scales with the font size. Only the first format-tab-title handler in the file runs, so keep it in one place.

Look again at the bottom left of the first screen: when the leader key Ctrl+U is pressed, a lavender block with a wave icon appears at the left end of the tab bar. It shows that WezTerm is waiting for the next key, and it uses the same lavender as the border. How to build it is in the leader indicator part of the first post. The keys you press after the leader are listed in the shortcut menu post.

Pick one theme for light mode and one for dark mode

When you switch the Windows app mode to light, WezTerm can switch to a light theme too. That is easiest with a theme family that has both a dark and a light variant. Alex Plescan's Tokyo Night and Tokyo Night Day in his WezTerm post are one example, and the built-in themes include many such pairs.

Four dark and light theme pairs

The top row shows the dark variants and the bottom row the light variants of the same families. Beyond these four, every pair in the table below was present in WezTerm on my PC.

Family Dark mode Light mode
Catppuccin Catppuccin Mocha Catppuccin Latte
Tokyo Night Tokyo Night Tokyo Night Day
Rosé Pine rose-pine rose-pine-dawn
Solarized Builtin Solarized Dark Builtin Solarized Light
Gruvbox Gruvbox dark, medium (base16) Gruvbox light, medium (base16)
Everforest Everforest Dark (Gogh) Everforest Light (Gogh)
One Half OneHalfDark OneHalfLight
Nightfox nightfox dayfox

Once you pick a pair, put the code below above return config and change the two names. wezterm.gui.get_appearance() reports the current mode as Dark or Light, and high-contrast modes add a suffix, as in DarkHighContrast. So the code only checks whether the value contains Dark.

local function appearance()
  if wezterm.gui then
    return wezterm.gui.get_appearance()
  end
  return "Dark"
end

local function scheme_for_appearance(mode)
  if mode:find("Dark") then
    return "Catppuccin Mocha"
  end
  return "Catppuccin Latte"
end

config.color_scheme = scheme_for_appearance(appearance())
Enter fullscreen mode Exit fullscreen mode

The code checks wezterm.gui first because the configuration is also read where there is no screen. The mux server that keeps sessions alive after you close the window is one such place, and there the code assumes dark mode. The official example does the same. My PC has the Windows app mode set to dark, and a window opened with this configuration picked Mocha. According to the official docs, WezTerm also notices a mode change while it is running and reloads the configuration.

Other people's touches

From configs online I picked two more ideas that my setup does not use.

  1. Coloring the status bar from the theme. The Alex Plescan post above reads the current theme's background and paints the right status bar segments in progressively brighter shades of it. When the theme changes, the status bar follows. It is the opposite of how I typed lavender in by hand.
  2. A translucent background. The same post uses 0.9 background opacity with a blur effect on macOS. On Windows you set win32_system_backdrop to Acrylic (Windows 10 and 11) or Mica or Tabbed (Windows 11 build 22621 and later). The effect only shows when window_background_opacity is below 1.0. My setup keeps these two lines commented out.

You can also rework a whole theme. Catppuccin's page shows an example that copies the built-in Mocha, changes the background to pure black and registers it under a new name. For a few colors, colors from earlier is enough; this approach fits when you change many colors and want a separate name.

Summary

Change the WezTerm theme with one color_scheme line and override only the colors that bother you with colors. The tab bar follows the theme, so you only type in colors the theme lacks, such as the border. If you choose a theme with a light variant, it can switch with the Windows mode on its own. My full configuration is in the published .wezterm.lua file.

Add config.color_scheme = "Catppuccin Macchiato" to your configuration file now and save it.

Related articles

Top comments (0)