How can I customize python syntax highlighting in VS code?
In Visual Studio Code you can use color themes which are built-in, install new created by community and uploaded to Marketplace or edit allready existed. If you only want to customize a specific color of syntax e.g. function name, you need to edit settings.json file.
To do this go to File > Preferences > Settings > Workbench > Appearance and in sections Color Customizations click on Edit in settings.json
Now you need to specify what exactly you want customize by adding code in this file and just save it.
This code will change color of function name to orange:
"editor.tokenColorCustomizations": {
"functions": "#FF9900"
If you want to change some other settings e.g. variables, strings, numbers follow this pattern:
"editor.tokenColorCustomizations": {
"what_you_want_to_customize" : "hex_value_of_color"
If you want to change color when you call methods you need to specify scope (in the same settings.json file):
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.function-call",
"settings": {
"foreground": "#FF9900"
}
}
Now when you call function in some objects it will appear as orange color.
Here's how it looks with pandas.DataFrame():
If you create your own method in objects it will also be color of your choice.
And this is how it looks when you combine this two settings.
I've just change color to red when function is created and orange when function is called for better explanation.
There is also official docs for further reading and much more settings to make it custom looks (text, bars, buttons).
Correct form of Stoockbroker's answer. (missing parentheses corrected.)
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.function-call.generic.python",
"settings": {
"foreground": "#FF0000"
}
}
]
},
https://github.com/MagicStack/MagicPython/issues/127