You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为不同括号类型设置独立颜色池?

实现VSCode不同括号类型独立颜色池设置

要让VSCode中不同类型的括号使用独立颜色池,按以下步骤配置:

  1. 打开VSCode设置文件(快捷键Ctrl+,,然后点击右上角的打开设置(JSON)图标)。
  2. 添加以下配置项:
{
  // 启用括号配对着色
  "editor.bracketPairColorization.enabled": true,
  // 开启不同括号类型独立颜色池
  "editor.bracketPairColorization.independentColorPoolPerBracketType": true,
  // 自定义各括号类型的颜色池
  "workbench.colorCustomizations": {
    // 圆括号(()):红色系色调
    "editorBracketHighlight.foreground1": "#ff4444",
    "editorBracketHighlight.foreground2": "#ff6666",
    "editorBracketHighlight.foreground3": "#ff8888",
    // 方括号([]):蓝色系色调
    "editorBracketHighlight.foreground4": "#4444ff",
    "editorBracketHighlight.foreground5": "#6666ff",
    "editorBracketHighlight.foreground6": "#8888ff",
    // 花括号({}):绿色系色调
    "editorBracketHighlight.foreground7": "#44ff44",
    "editorBracketHighlight.foreground8": "#66ff66",
    "editorBracketHighlight.foreground9": "#88ff88"
  }
}

配置说明

  • 开启independentColorPoolPerBracketType后,VSCode会按括号类型分配连续的颜色组:()使用前3个颜色,[]使用中间3个,{}使用最后3个(最多支持9层嵌套的颜色)。
  • 你可以根据喜好替换颜色值,比如调整红色/蓝色/绿色的深浅度,或者更换其他色系。
  • 确保你的VSCode版本已修复相关问题(即版本足够新,支持该功能正常运行)。

内容的提问来源于stack exchange,提问作者user14554732

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 13:55:20