Skip to content

主题

Blue 的视觉表面全部由一张语义色表驱动。/theme 命令在这张表的不同提供方之间热切换——切换会重建渲染树,但输入草稿、历史与输入模式经 draft stash 存活。

/theme 用法

usage: /theme [dark|light|auto|custom <path> [dark|light]]
  • /theme —— 列出全部主题并标出当前项(dark, light, auto, custom
  • /theme dark / /theme light —— 切到内置调色板
  • /theme auto —— 跟随终端背景色(OSC 11 探测)自动选择明暗
  • /theme custom <path> [dark|light] —— 挂载文件调色板,base 指定兜底基线(默认 dark

切换实现为 provider fiber 的整体替换:依赖主题的插件(transcript、输入层等)随之重载。挂载失败时会自动回退到内置 dark 调色板,界面永远不会没有主题。

custom:JSON 调色板

custom 主题从 JSON 文件读取 token 到 #rrggbb 十六进制色的映射,叠在 base(dark 或 light)之上:

json
{
  "primary": "#4fa8ff",
  "accent": "#5bc0be",
  "roleUser": "#ffcb6b",
  "selectedBg": "#3a3a4a"
}

规则:

  • 只需写想覆盖的 token,其余落到 base 的对应项;
  • 未知 token(不在下表中)与非法颜色(非 #rrggbb 格式)会被丢弃并打印警告,回退 base 对应项;
  • 文件不可读或不是 JSON 对象时,整表回退 base。

语义 token 表

以 dark 调色板的值为参照(light/auto 各有对应值;auto 按 OSC 11 探测结果二选一):

基础

tokendark 值用途
text#e0e0e0正文、状态栏最亮档(model、context)
textStrong#ffffff强调文本
muted#888888次要文本、状态栏中档(cwd、git 徽章)
textMuted#6b6b6b最暗档(工具摘要行、tips、代码块边框)
accent#5bc0be点缀色(横幅模型行)
primary#4fa8ff主色(斜杠语境编辑框、运行态工具圆点、链接)
border#5a5a5a常规边框
borderFocus#e8a838焦点边框(审批面板横线)
success#4ec87e成功态
error#e85454错误态
warning#e8a838警告态
selectedBg#3a3a4a列表选中行背景
roleUser#ffcb6b用户消息 边栏
shellMode#bd93f9! bash 模式(编辑框、$ 前缀)

Markdown 渲染

tokendark 值用途
mdHeading#e0e0e0标题
mdLink#4fa8ff链接文字
mdLinkUrl#6b6b6b链接 URL
mdCode#4fa8ff行内代码
mdCodeBlock#e0e0e0代码块正文
mdCodeBlockBorder#6b6b6b代码块边框
mdQuote#888888引用文字
mdQuoteBorder#888888引用竖线
mdHr#5a5a5a水平分割线
mdListBullet#e0e0e0列表符号

diff 着色

tokendark 值用途
diffAdded#4ec87e新增行
diffRemoved#e85454删除行
diffAddedStrong#7ad99b新增行(强调)
diffRemovedStrong#f08585删除行(强调)
diffGutter#6b6b6bdiff 行号槽
diffMeta#888888diff 文件头元信息

预览版 · v0.1.0-rc.1