Search code examples
colorsspecial-characterswhitespacevisual-studio-code

Change the color of special characters in VS Code?


In VS Code, I would like to highlight any tab characters that appear in my code in bright red as I prefer to use spaces only.

I have the render whitespace setting enabled, and I have looked through the Theme Color configurations, but I am not seeing anything that I can set relating to special characters.

Is there any way currently to add this customization?


Solution

  • As mentioned by rioV8, the method to do this is to use the Highlight extension for VS Code and add this to your settings.json:

    "highlight.regexes": {
        "(\\t)": [
            {
                "color": "red"
            }
        ]
    }