1. Introduction: Why VSCode Grays Out Inactive Text
If you’ve noticed that certain lines of your code appear dimmed or gray in Visual Studio Code (VSCode), you’re not alone. This feature is designed to visually mark inactive, unused, or unreachable code. While helpful for debugging, it can sometimes be distracting — especially if you want your code to look clean and uniformly colored. In this guide, we’ll show you exactly how to disable graying out inactive text in VSCode with simple settings and configuration tweaks.
2. What Does Grayed Out or Inactive Text Mean?
When VSCode grays out text, it’s telling you that the editor or language extension has marked it as inactive. This might happen when:
- The code is inside an inactive preprocessor block (like
#if
in C# or C++). - A variable or import is declared but never used.
- A code path is unreachable (like after a
return
statement). - An extension or theme marks it as deprecated or unused.
The goal is to help you identify code that doesn’t affect program execution — but you can easily turn this effect off.
3. Reasons You Might Want to Disable Grayed Out Code

There are a few reasons why developers prefer to disable this feature:
- It makes the editor look cleaner and easier to read.
- You don’t want to be distracted by visual cues while coding.
- The graying effect sometimes clashes with color themes.
- It can make text harder to see on low-contrast displays.
If this sounds familiar, keep reading — the solution is quick and easy.
4. Quick Fix: Disable Grayed Out Code from VSCode Settings
Let’s start with the simplest method — through the VSCode settings interface.
Step 1: Open Settings
- Press Ctrl + , (comma)
or - Go to File → Preferences → Settings.
Step 2: Search for “Unused” or “Dim”
In the search bar, type “unused” or “dimmed”.
Step 3: Turn Off Unused Code Highlighting
Locate the setting:
👉 Editor › Unused: Enabled
Uncheck this box to disable graying out inactive or unused text.
That’s it! Your code will now appear in normal color without the faded effect.
5. Disable Grayed Out Code Using Settings.json
For developers who like to edit configuration files directly, you can disable the feature via settings.json.
Steps:
- Open the Command Palette (
Ctrl + Shift + P
). - Type “Preferences: Open Settings (JSON)” and press Enter.
- Add the following line:
"editor.unused.enabled": false
- Save the file.
- Restart or reload VSCode (
Ctrl + Shift + P → Reload Window
).
This setting removes the dimming effect globally for all programming languages.
6. Adjust the Opacity Instead of Disabling Completely
If you don’t want to remove the effect but prefer it to be less visible, you can adjust the opacity:
In settings.json
, add:
"editor.unused.opacity": 1
Setting the opacity to 1 makes inactive code appear just as dark as active code.
You can also experiment with values like 0.8
or 0.9
for a softer look instead of a full disable.
7. How to Disable Graying Out for Specific Languages
Sometimes you only want to disable the feature for specific languages (e.g., Python or JavaScript).
Here’s how you can do it:
For JavaScript and TypeScript:
"[javascript]": {
"editor.unused.enabled": false
},
"[typescript]": {
"editor.unused.enabled": false
}
For Python:
"[python]": {
"editor.unused.enabled": false
}
For C# or C++:
"[csharp]": {
"editor.unused.enabled": false
},
"[cpp]": {
"editor.unused.enabled": false
}
This way, you can keep VSCode’s helpful graying effect active in some languages while disabling it in others.
8. When Preprocessor Directives Cause Inactive Text
In languages like C# or C++, the grayed-out text often results from preprocessor directives such as:
#if DEBUG
Console.WriteLine("Debug mode");
#else
Console.WriteLine("Release mode");
#endif
When “DEBUG” isn’t active, that section becomes dimmed.
To stop VSCode from visually dimming these regions:
- Go to Settings → Extensions → C#.
- Search for “Dim inactive regions”.
- Turn it off.
9. For Python Users: Disable Grayed Out Text via Pylance
In Python projects, the Pylance extension is often the reason behind inactive or faded code.
Steps:
- Open Settings (
Ctrl + ,
). - Search for “Pylance type checking mode”.
- Set it to off or basic.
Alternatively, editsettings.json
:
"python.analysis.typeCheckingMode": "off"
This disables Pylance’s dimming effect on unused or unreachable code.
10. Adjust Theme or Color Customizations
In some themes, graying is handled by color settings rather than VSCode’s logic.
You can override these using Color Customizations.
Add this snippet in settings.json
:
"workbench.colorCustomizations": {
"editorUnnecessaryCode.opacity": "1"
}
This forces inactive text to display at full opacity — regardless of theme or extension settings.
11. Disabling Extension-Level Graying
Sometimes, extensions like ESLint, IntelliCode, or SonarLint apply their own visual cues.
To identify which one is responsible:
- Open the Extensions panel (Ctrl + Shift + X).
- Disable one extension at a time.
- Reload VSCode to see if the graying disappears.
Once you find the cause, open that extension’s settings and disable its “dim unused code” feature.
12. Troubleshooting: Grayed Text Won’t Go Away
If you’ve changed all settings and your code is still grayed out:
- Restart VSCode.
- Use “Developer: Reload Window” from the Command Palette.
- Make sure there isn’t a workspace-specific setting overriding your global one (
.vscode/settings.json
in your project). - Check if your theme or syntax extension is reapplying the style.
13. Pros and Cons of Grayed Out Code
Before you fully disable this feature, it helps to understand the trade-offs.
✅ Pros of keeping it on:
- Identifies unused code at a glance.
- Helps optimize and clean up your project.
- Prevents unused imports from piling up.
❌ Cons of keeping it on:
- Visually distracting for some developers.
- Hard to read in dark or low-contrast themes.
- May mark code as “inactive” when it’s actually fine (false positives).
Choose what suits your workflow best — you can always re-enable it later.
14. Alternative: Hide Inactive Code Instead of Dimming
If you’d rather hide inactive regions instead of dimming them, certain extensions like Hide Inactive Code Blocks or Better Comments can do this.
Simply search for them in the VSCode Marketplace and enable “Hide inactive code regions.”
This can make your editor look cleaner without changing your actual settings.
15. Summary: The Quickest Way to Disable Graying Out in VSCode

Here’s a recap of how to disable grayed-out or inactive text in VSCode:
- Go to Settings → Search “unused”.
- Turn off Editor › Unused: Enabled.
- Or add
"editor.unused.enabled": false
in settings.json. - Adjust opacity with
"editor.unused.opacity": 1
. - Reload VSCode to apply changes.
You can also fine-tune by language or disable dimming via extensions and color themes.
Conclusion: Personalize VSCode the Way You Like
Grayed out code is a helpful feature, but not everyone finds it useful. With just a few clicks or a quick tweak in your settings.json
, you can completely disable or customize it. Whether you want a cleaner editor, higher visibility, or a more personalized coding experience, knowing how to disable graying out inactive text in VSCode gives you full control over how your code looks and feels.
How to Disable Graying Out Inactive Text in VSCode
1. Why is my code grayed out in VSCode?
It indicates that the code is inactive, unused, or unreachable, depending on the language and extension.
2. How can I stop VSCode from dimming unused code?
Open Settings → Search “unused” → Uncheck Editor › Unused: Enabled.
3. How do I fix grayed out imports or variables?
They’re marked as unused. You can either remove them or disable linting for unused items.
4. Is grayed out text a bug?
No — it’s a visual feature meant to help developers identify inactive code.
5. Can I just make it less gray instead of turning it off?
Yes! Set "editor.unused.opacity": 0.9
or "editorUnnecessaryCode.opacity": "1"
for full visibility.