简体   繁体   English

Angular - 如何在 VS Code 的 html 文件中更改变量的颜色?

[英]Angular - How to change variable's color in html file in VS Code?

Question has been asked before, but with no answers.以前有人问过问题,但没有答案。

I have this snippets in html and ts component files:我在 html 和 ts 组件文件中有这个片段:

在此处输入图像描述

在此处输入图像描述

I would like to have the variables: allowNewServer and serverCreationStatus colored purple.我想要变量: allowNewServerserverCreationStatus为紫色。
My VS Code plug-ins: Angular Essentials (Version 9)我的VS Code插件:Angular Essentials(第9版)

I use this VS Code plugin that adds syntax highlighting to angular html templates.我使用这个VS Code 插件,它为 angular html 模板添加了语法高亮。

To further enhance to color it specifically purple, you'll have to tweak your theme or editors textMateRules settings.为了进一步增强它的颜色,特别是紫色,您必须调整您的主题或编辑器textMateRules设置。

In your settings.json :在您的settings.json

"editor.tokenColorCustomizations": {
      "textMateRules": [
        {
          "scope": [
            "expression.angular-interpolation",
            "source.directive.angular"
          ],
          "settings": {
            "foreground": "purple" // or use your desired hex code
          }
        },
      ]
  },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM