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

VSCode侧边栏自定义颜色:如何让激活选中项应用Git装饰色?

解决VSCode侧边栏激活选中项Git颜色不生效的问题

要让侧边栏激活选中的文件也遵循gitDecoration配置的Git状态颜色,核心是调整list.activeSelectionForeground的优先级:

  • 默认list.activeSelectionForeground的优先级高于Git装饰色,只要配置了该值,激活选中项就会强制使用统一颜色,忽略Git状态
  • 将list.activeSelectionForeground设为null或直接删除该配置,VSCode就会自动使用对应Git状态的gitDecoration颜色作为激活选中项的前景色,和非激活选中项行为一致

示例配置

"workbench.colorCustomizations": {
  "list.activeSelectionForeground": null,
  "list.inactiveSelectionForeground": "#ffffffd8",
  // 根据需求自定义各Git状态的颜色
  "gitDecoration.addedResourceForeground": "#50fa7b",
  "gitDecoration.modifiedResourceForeground": "#f1fa8c",
  "gitDecoration.deletedResourceForeground": "#ff5555",
  "gitDecoration.untrackedResourceForeground": "#bd93f9",
  "gitDecoration.ignoredResourceForeground": "#6272a4"
}

补充说明

如果需要保留激活选中项的背景色,可以继续添加list.activeSelectionBackground配置,不会影响前景色的Git状态显示。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 05:42:31