【问题标题】:Change color of json file keywords or comments in VS Code在 VS Code 中更改 json 文件关键字或注释的颜色
【发布时间】:2021-06-14 15:02:40
【问题描述】:

我想自定义 cmets 或关键字的颜色(不确定它们叫什么,但我已经在附图中描述了它们。)。那么如何在 vs 代码中使用“editor.tokenColorCustomizations”更改它们的颜色。(红色的代码必须改。)

【问题讨论】:

    标签: visual-studio-code vscode-settings


    【解决方案1】:

    使用命令面板中的Scopes Inspector,单击这些 json 键,您将看到它们的作用域。在您的settings.json 中可以这样使用:

      "editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "support.type.property-name.json.comments",
            "settings": {
              "foreground": "#00ff00",
              "fontStyle": "bold",
            }
          }
        ]
      }
    

    如果您想将上述更改限制为特定颜色主题,请使用此表单:

    ```jsonc
      "editor.tokenColorCustomizations": {
        "[Monokai Classic]": {              // your theme name here
          "textMateRules": [
            {
              "scope": "support.type.property-name.json.comments",
              "settings": {
                "foreground": "#00ff00",
                "fontStyle": "bold",
              }
            }
          ]
        }
      }
    

    【讨论】:

      猜你喜欢
      • 2019-02-09
      • 2022-01-21
      • 2018-11-25
      • 2022-06-30
      • 1970-01-01
      • 1970-01-01
      • 2023-02-07
      • 2011-10-22
      • 2021-04-13
      相关资源
      最近更新 更多