10. 配置、主题与终端

主题

更换全屏色板。/theme 只存在于全屏:精简模式用终端自己的颜色绘制,忽略主题设置。

内置色板

名称不区分大小写。规范 id(Matcha 写入的值)写在反引号里。

显示名规范 id也接受真彩色
Matcha Nightmatchanightmatcha-nightdarkgroknightgrok-night
Matcha Daymatchadaymatcha-daylightdaygrokdaygrok-day
Tokyo Nighttokyonighttokyo-nighttokyo
Rose Pine Moonrosepine-moonrosepinerose-pinerose-pine-moon
Oscura Midnightoscura-midnightoscura

Matcha Night 是默认色板。它在 256 色和 16 色终端上也能干净地量化。Tokyo Night、Rose Pine Moon 与 Oscura Midnight 需要 24 位色;缺少真彩色时 /doctor 会从选择器里藏起它们,但 /theme tokyonight 仍被接受,现场颜色会被限制到当前色深。

auto(别名 system)跟随系统浅色/深色外观。它本身不是一块色板。

在 TUI 里切换

仅全屏:

  1. 输入 /theme(别名 /t)。
  2. 在列表里移动。每一行都会预览,不写磁盘。
  3. 按 Enter 应用并保存,或按 Escape 恢复上一主题。

其它写法:

/theme tokyonight
/theme auto
/theme

带名称则套用该色板(或 auto)。不带参数的 /theme 在本终端当前可用的具体主题里循环到下一个。

写入 config.toml

色板在 ~/.matcha/config.toml,不在 pager.toml

[ui]
theme = "tokyonight"

pager.toml 控制边距、滚动条、动画和 [terminal] alt_screen。它没有 theme 键。

紧凑模式(/compact-mode)是单独的 [ui] compact_mode 开关:边距更少,色板不变。

跟随系统外观

[ui]
theme = "auto"
auto_dark_theme = "tokyonight"
auto_light_theme = "matchaday"

默认:深色 → Matcha Night,浅色 → Matcha Day。也可以从 /settings → Appearance → Auto dark theme / Auto light theme 设置这两处映射。在 /theme 选择器里选 auto 会按这些映射打开自动模式。选一个具名主题则关闭自动模式。

检测方式:

环境方式
macOSAppleInterfaceStyle
LinuxXDG Desktop Portal color-scheme
Windows个性化注册表
SSH / tmux / 无界面环境戳记,然后 COLORFGBG,再在启动时发 OSC 11 查询

本机桌面上 Matcha 大约每 5 秒轮询一次,所以切换系统外观后 TUI 无需重启就会更新。SSH 上,wrap 盖上的值在这一跳保持不变。

matcha wrap ssh … 会按本机系统外观盖上 LC_GROK_APPEARANCE,好让远端的 theme = "auto" 能解析。这个名字仍是只读兼容戳记。新 tmux 会话只有在 tmux 服务启动时带上该环境(或 update-environment 包含它)才会继承。

环境变量覆盖

产品注册名是 MATCHA_THEMEMATCHA_APPEARANCE(对应 Matcha 名未设置时,才读只读兼容的 GROK_*)。

颜色支持

启动时 Matcha 检测真彩色、256 色或 16 色,然后把每个主题槽位(以及运行时语法色)量化到该级别。NO_COLOR 关闭颜色。

运行 /doctor,看 color truecolorthemes all。在 tmux 里,Matcha 可以发出 24 位色,但 tmux 可能改写它;那是 terminal.tmux-truecolor。见「终端支持」。

在支持这些序列的终端上,Matcha 还会把光标设成主题强调色(OSC 12),退出时复位(OSC 112)。

核对一下

  1. 全屏里 /theme → 预览 Matcha Day → Enter。确认 ~/.matcha/config.toml 里有 [ui] theme = "matchaday"(规范 id matchaday)。
  2. /theme auto,然后切换系统外观,等几秒。
  3. /minimal,输入 /theme,确认被拒绝。再用 /fullscreen 返回。