Make VSCode Variables have Colour

后端 未结 3 1589
猫巷女王i
猫巷女王i 2021-02-06 15:45

I would like to make variables displayed with colours.

This is how it looks:

This is how I want it to be:

Looking through here, I canno

相关标签:
3条回答
  • 2021-02-06 16:25

    Try this setting in your settings.json:

     "editor.tokenColorCustomizations": {
        "variables": "#f00"
     },
    

    There are a few such simple token color customizations available: variables, comments, keywords, functions, numbers, strings and types. Those only allow setting the color though.

    If you use "textMateRules" you can set more properties. For example:

    "editor.tokenColorCustomizations": {
      "textMateRules": [
        {
          "scope": "comment",
          "settings": {
            "fontStyle": "italic",
            "foreground": "#C69650"
          }
        }
      ]
    },
    
    0 讨论(0)
  • 2021-02-06 16:27

    You should be able to add the color in tokenColors to customize the colors (basic example):

    SomeTheme.json

    { 
     "name": "Some Theme",
     "type": "dark",
     "colors": {
     ...
    },
    "tokenColors": [
       {
        "name": "Variables",
        "scope": "variable",
        "settings": {
        "foreground": "#e06c75"
       }
      },
     ]
    }
    

    I don't have VSCode, although from looking at another themes JSON it looks similar.

    0 讨论(0)
  • 2021-02-06 16:28

    This is working for me. It makes it look like the default Javascript formatting as far as I can see.

    In settings.json

    "editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "meta.function-call.generic.python",
            "settings": {
              "foreground": "#DCDCAA"
            }
          },
          {
            "scope": "source.python",
            "settings": {
              "foreground": "#9CDCFE"
            }
          },
          {
            "scope": "punctuation.definition.string.begin",
            "settings": {
              "foreground": "#ce9178"
            }
          },
          {
            "scope": "punctuation.definition.string.end",
            "settings": {
              "foreground": "#ce9178"
            }
          },
          {
            "scope": "punctuation",
            "settings": {
              "foreground": "#dfdfdf"
            }
          }
        ]
    }
    
    0 讨论(0)
提交回复
热议问题