Tired of straining your eyes in low-light conditions while coding? Visual Studio Code (VS Code) offers a dark mode feature to alleviate eye fatigue and enhance your coding experience in dim environments. Here's a comprehensive guide on how to change dark mode in Visual Studio Code.

VS Code's dark mode, also known as High Contrast theme, inverts the scheme, making text brighter and backgrounds darker. This makes it easier to read code in low-light conditions, reducing eye strain and potentially increasing your productivity. Let's dive into the process of toggling dark mode on and off.

Understanding Visual Studio Code Themes
Before changing themes, it's essential to understand that VS Code offers a variety of built-in themes and allows you to create or import your own. Themes customise the color scheme of the VS Code interface, including text, syntax highlighting, and UI elements.

The High Contrast theme is one of the built-in dark themes. You can differentiate it from other dark themes by its brighter text color and dark background. Knowing this will help you easily locate and toggle the dark mode theme.
Accessing Settings.json

The settings.json file is a configuration file where you can store VS Code preferences. It's a convenient place to turn on dark mode permanently, rather than toggling it on/off every time you restart VS Code.
To access settings.json, press Ctrl+, (comma) on Windows/Linux or ⌘+, on Mac to open the Settings window. Click on the "Open Settings (JSON)" button at the bottom left. This will open the settings.json file in a new editor tab.
Enabling Dark Mode via settings.json

To enable dark mode permanently, you need to add the following lines to the settings.json file:
"workbench.colorScheme": "High Contrast"
These lines set the "workbench.colorScheme" to "High Contrast", which is the identifier for the dark mode theme in VS Code.

After adding the lines, save the settings.json file. VS Code will switch to the dark mode theme the next time it's opened.
Toggling Dark Mode On/Off









If you prefer to toggle dark mode on and off manually each time, you can do so easily with a simple keyboard shortcut or through the command palette.
VS Code provides a default keyboard shortcut for toggling themes. Press Ctrl+Shift+P on Windows/Linux or ⌘+Shift+P on Mac to open the Command Palette. Type "Toggle Color Theme" and press Enter. VS Code will cycle through the available themes, including the dark mode theme.
Setting a Custom Keyboard Shortcut
If you want a dedicated keyboard shortcut for dark mode, you can create one in VS Code. In the Command Palette, type "Open Keyboard Shortcuts". Add a new shortcut with the following command:
{ "command": "workbench.action.toggleTheme", "key": "ctrl+alt+t" }
This sets a new keyboard shortcut Ctrl+Alt+T for toggling the theme on Windows/Linux or ⌘+Option+T on Mac.
Additional Dark Themes
VS Code offers several other dark themes apart from the High Contrast theme. You can explore these themes and decide which one best suits your coding needs. To do this, open the Command Palette and type "Open Setting: Color Theme".
Choosing a theme is a personal preference, so feel free to experiment with different themes to find the one that enhances your coding experience.
That's it! You're now equipped to navigate Visual Studio Code's dark mode with ease. Whether you prefer to set it permanently in the settings.json file or toggle it on and off manually, your coding experience in low-light conditions just got better. Happy coding!