Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change color of characters surrounding comments in VS Code

how can I change the color of the characters that come before and after a comment in vs code. Im Talking about or /* */ or # characters. I know how to change the comment color

How do I change color of comments in visual studio code?

but couldn’t find anything regarding the „framing“ characters.

like image 307
aerioeus Avatar asked Sep 04 '18 22:09

aerioeus


People also ask

How do you make text colorful in VS Code?

Press 'Ctrl+shift+P' from the keyboard to open VS Code command palette. Search: 'Inspect Editor Tokens and Scopes' Take the cursor on the text or tag, you want to change the colors.

How do you change the font in comments in VS Code?

Open your VS editor. Navigate to the upper part of the screen and select File. Now, in the drop-down menu, go to Preferences > Settings. You'll now see the Commonly Used section with a menu on the right-side of the screen, you can access the font from this page or by following the step below.


1 Answers

You can do this rather simply. Use "Inspect TM Scopes" in the command palette to inspect those characters. It will give a different scope for each language, something like :

punctuation.definition.comment.js

for javascript comments. Now you can use that in your user settings like so:

"editor.tokenColorCustomizations": {
    "textMateRules": [

      {
        "scope": "punctuation.definition.comment.js",
        "settings": {
          "foreground": "#f00",
        }
      }
   ]
}

You will obviously have a different but similar scope for other languages.


And see the short answer added to How to change VisualStudioCode comment color with it's slashes? about possible plans to fix this in the October, 2019 release. So the punctuation would not have to be independently colored. [It is now fixed in the Insider's Build.]

like image 132
Mark Avatar answered Sep 30 '22 07:09

Mark