Home > Software engineering >  VS Code, disable `grey` color on the codes inside #ifdef
VS Code, disable `grey` color on the codes inside #ifdef

Time:02-03

As you can see in this image, some code (it is int aaa = 1) inside #ifdef (a preprocessor block) is grey, it is inconvenient to read when there is a lot of similar code. Is there a way to remove the grey color on it, and makes it same color like int aaa = 0 in the image?

The output in image is for C code, append the code here in case the pic cannot be shown:

#ifdef _DEBUG    
    int aaa = 0    
#else    
    int aaa = 1    
#endif 

I had tried some configurations in workbench.colorCustomizations, but didn't find the right one.

CodePudding user response:

The setting you are looking for is C_Cpp.dimInactiveRegions. You can put that in a settings.json file like this:

"C_Cpp.dimInactiveRegions": false

The setting's description:

Controls whether inactive preprocessor blocks are colored differently than active code. This setting has no effect if IntelliSense is disabled or if using the Default High Contrast theme.

  • Related