How Can I Change The Coloring Of Parentheses And Brackets?
Solution 1:
In Visual Studio Code, you can customize a lot of syntax colors to your individual needs.
Let's say we want to change syntax color of a specific comma - for example the one used to seperate function parameters - you'll need to know what identifier that token has. To find out this just hit ctrl+shift+P
and type in Developer: Inspect TM Scopes
.
Then click anywhere inside an opened script and select the desired character or keyword you want to know more about. As you can see below the identifier for commas between function parameters in Python is punctuation.separator.parameters.python
(btw. there is also a token named punctuation.separator.arguments.python
, so you could even use a different color for the commas between arguments):
Now that you have the required identifier for that token, you can add the following to your settings.json
:
"editor.tokenColorCustomizations":{"textMateRules":[{"scope":"punctuation.separator.parameters.python","settings":{"foreground":"#ff8800","fontStyle":"bold"}}]}
As you can see you're not only able to change the color, you're also able to change font style if you want and you can place as many scopes within "textMateRules"
as you want.
This works for parentheses, brackets and curly brackets as well as for colons, any kind of operators, keywords like class
, def
, etc.
In this way you can adjust syntax coloring without having to change the whole theme. And of course you can do this with nearly every language available in VSCode.
Note: The code above applies changes only to Python language and will display the selected colors only in Python scripts. For other programming languages you'll first have to inspect the code of the desired language (like described above) to find out the identifiers of the tokens (unfortunately I've not yet found a list of all available tokens to choose from, so, if somebody knows from where or how to get it, feel free to add a comment - thx).
Post a Comment for "How Can I Change The Coloring Of Parentheses And Brackets?"