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
相关产品推荐
相关产品推荐

