Use VSCode Dimmer to Highlight Code when Teaching

Share this video with your friends

Send Tweet
Published 3 years ago
Updated a year ago

The VSCode Dimmer extension is great when you want to show and explain code to someone. It helpfully dims the code that's not relevant to the selected line, making it easier for your audience to focus on what you want them to.

Instructor: [00:01] Install the VS Code dimmer extension from the marketplace. I've got a demo file here we can use to test this new extension.

[00:11] Activate the dimmer by opening up the command palette and searching for ataco dimmer. Now that it's enabled, it'll dim all of the lines except for the current one.

[00:23] This is cool, but we can configure it to be more helpful. First, let's set a key binding so we can activate it via keyboard instead of the command palette. Open the keyboard shortcuts menu. Search for dimmer, and let's add a custom keybinding of Alt D.

[00:47] Back in our demo file, we can test our new keyboard shortcut to toggle the dimmer on and off. We can also change the number of lines that are dimmed as well as the opacity of the dimmed lines. Let's configure these in the settings.

[01:06] We can change the dimmer context value to control the number of lines above and below the current selected line that are not dimmed. Let's set that to two. Let's also change dimmer opacity so that the non-dimmed lines are easier to see.

[01:25] Coming back to our demo file, you can see that the dimmed lines are more transparent and more of the lines surrounding the currently selected line are visible.