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

如何修改Visual Studio Code中行号区域的背景颜色?

如何修改VSCode行号区域的背景颜色?

要修改VSCode行号区域的背景颜色,你需要使用以下两个配置项:

  • editorLineNumber.background:控制普通行号的背景颜色
  • editorLineNumber.activeBackground:控制当前激活行的行号背景颜色

你之前尝试的editorLineNumber.foreground等选项仅作用于行号文字的颜色,无法修改背景区域。将上述两个配置项添加到你的workbench.colorCustomizations中即可实现需求,比如设置为和编辑区背景一致的#181825:

"workbench.colorCustomizations": {
    "[Catppuccin Mocha]": {
      "editor.background": "#181825",
      "editor.foreground": "#cdd6f4", // 注意:原配置中foreground和background颜色相同会导致文字不可见,建议改为主题默认前景色
      "terminal.background": "#181825",
      "activityBar.background": "#181825",
      "statusBar.background": "#181825",
      "editorGroupHeader.tabsBackground": "#181825",
      "tab.inactiveBackground": "#181825",
      "tab.activeBackground": "#181825",
      "breadcrumb.background": "#181825",
      "editorLineNumber.background": "#181825",
      "editorLineNumber.activeBackground": "#181825"
    }
  }

另外提醒:你原配置里将editor.foreground设为#181825,和背景色完全一致会导致编辑区文字无法显示,建议调整为对应主题的前景色(比如Catppuccin Mocha的默认前景色是#cdd6f4),保证正常的代码编辑体验。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 06:53:12