Home > Software design >  What is the meaning of the colors within this string literal?
What is the meaning of the colors within this string literal?

Time:08-04

As far as I can tell, the following is just a simple string literal with four escapes for the double quotes:

string x = "{ \"Matter\": \"openDate\" }";

Why does Visual Studio make the curly braces and the semicolon black and \"Matter\" brown? Shouldn't the whole thing be red, like \"openDate\"?

enter image description here

CodePudding user response:

It does appear to be intentional JSON highlighting. If you go to Tools -> Options -> Environment -> Fonts and Colors, you can see and change the settings:

enter image description here

You can turn it on and off in the settings here (note I had to close the file and re-open it for the changes to take effect):

enter image description here

  • Related