在首选系统颜色主题上调节 VS 代码设置 属性

Conditioning VS Code settings property on preferred system color theme

我想在 VS Code 设置中设置一个 属性,使其以系统的首选颜色主题为条件。

VS Code 允许您通过将 workbench.autoDetectColorScheme 设置为 true 来检测配色方案。然后您可以为属性设置颜色主题 - workbench.preferredLightColorThemeworkbench.preferredDarkColorTheme.

有什么方法可以设置像 terminal.background 这样的属性,使它们随 workbench 颜色主题一起改变吗?

根据 的建议,我解决了这个问题:

{
  "window.autoDetectColorScheme": true,
  "workbench.preferredLightColorTheme": "Small Aperture",
  "workbench.preferredDarkColorTheme": "Large Aperture",
  "workbench.colorCustomizations": {
    "[Small Aperture]": {
      "terminal.background": "#F2F7F2",
      //...
    },
    "[Large Aperture]": {
      "terminal.background": "#141414",
      //...
    },
  },
}

类似于 CSS 媒体查询,您可以使用方括号内的名称为不同的颜色主题设置不同的属性。

遗憾的是,您必须为您经常使用的所有主题添加部分。