Reputation: 1410
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.
Upvotes: 5
Views: 2323
Reputation: 181090
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.]
Upvotes: 5
Reputation: 3777
You can use the following to fully define the comment colors globally. You do not have to do one for each language!
settings.json
"editor.tokenColorCustomizations": {
"comments": "#636363",
"textMateRules": [{
"scope": "punctuation.definition.comment",
"settings": {
"foreground": "#636363",
}
}]
},
Notice I omitted the language, ie: .php
, from the end of the scope
line.
This will do both the beginning/end of the comment block, and the comment itself. I was baffled when I changed my comment colors and the /**
and */
where not changed. This solved it and made the comments all one color.
Upvotes: 2