Bojan Petrovic

Setting up the dark theme in SQL Server Management Studio

September 28, 2017 by

In SQL Server Management Studio 2016, Microsoft introduced a visual setting option to choose between the Blue and Light color theme. In SSMS 2016, SSMS 2017 and the latest SSMS 18, the user can switch between the Blue or Light theme by going to Tools | Options | Environment | General | Color theme:

Visual experience settings of SSMS in the Options dialog

SSMS Dark theme

Although it’s not officially supported by Microsoft, the Dark theme is also available in SQL Server Management Studio 2016, 17, and the latest 18 version. The dark theme has been very popular among SQL database administrators and developers. To enable the SSMS Dark theme, follow these simple steps.

Close SSMS if it is running. Run any text editor as an administrator, in this case, Notepad++ is used, in order to edit the SSMS configuration file:

Running Notepad++ as an administrator

The configuration (ssms.pkgundef) file is located at the following locations:

SSMS 2016

C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio

SSMS 17

C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio

SSMS 18

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE

Depending on SSMS version, locate and open the configuration file (ssms.pkgundef) in the text editor:

Opening the SSMS configuration file with Notepad++

Once the file is opened in the text editor, scroll down and find the section of the code under the “Remove Dark theme” heading, add “//” (without quotation marks) at the beginning of the first line like shown below, and save the file:

SQL Server Management Studio configuration file opened in Notepad++

Once completed, start SQL Server Management Studio and the Dark color theme will be available in the Color theme drop-down box:

SSMS Dark theme option under Visual experience settings

Problem with upgrades

Each upgrade of the latest generation of SSMS will set the configuration file back to its defaults. This will, of course, overwrite the tweak we made earlier and the Dark theme will no longer be available in the options.

Instead of doing the same steps to enable the SSMS Dark theme each time there is an upgrade, thanks to a reader (Luka Lovre) who made a PowerShell script, there’s an easier way with the same outcome which can be achieved in just a few clicks.

All we need to do is to run either Command Prompt or Windows PowerShell which is designed to improve the command-line and scripting. Either way, make sure to run the interpreter as an administrator or you’ll get an error message that access to the path is denied:

Running the script in Windows PowerShell without admin permissions

I’d go with the PowerShell because, in some cases, even upon successful execution of the script in Command Prompt, the changes are not applied (the case with SSMS 17.7). So, in this example, Windows PowerShell is used.

To run the PowerShell as an administrator, click Start, type PowerShell, right-click Windows PowerShell, and then choose Run as administrator:

Running Windows PowerShell as administrator

Depending on the version of SSMS, copy the appropriate script into the clipboard, paste it in PowerShell and hit Enter to execute it:

SSMS 2016

powershell -Command "(gc 'C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.pkgundef') -replace '\[\`$RootKey\`$\\Themes\\{1ded0138-47ce-435e-84ef-9ec1f439b749}\]', '//[`$RootKey`$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' | Out-File 'C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.pkgundef'"

SSMS 17

powershell -Command "(gc 'C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\ssms.pkgundef') -replace '\[\`$RootKey\`$\\Themes\\{1ded0138-47ce-435e-84ef-9ec1f439b749}\]', '//[`$RootKey`$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' | Out-File 'C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\ssms.pkgundef'"

SSMS 18

powershell -Command "(gc 'C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.pkgundef') -replace '\[\`$RootKey\`$\\Themes\\{1ded0138-47ce-435e-84ef-9ec1f439b749}\]', '//[`$RootKey`$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' | Out-File 'C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.pkgundef'"

The successfully executed script in Windows PowerShell to enable SSMS Dark theme

There will be no return message that the operation succeeded except the blinking cursor on a new line.

Once either of those two methods is done, startup SSMS, and change the visual appearance to dark. Here’s how it looks:

SSMS Dark theme

Note: As I mentioned before, the SSMS Dark theme is not officially supported and it probably never be and that’s why it is disabled by default. There might be some visual deviations e.g. white background in the Object Explorer, Results grid, etc.

To see how we’ve implemented visual themes in our products, see this article: Visual themes in ApexSQL tools

Bojan Petrovic
Installation, setup and configuration, SQL Server Management Studio (SSMS)

About Bojan Petrovic

Bojan aka “Boksi”, an AP graduate in IT Technology focused on Networks and electronic technology from the Copenhagen School of Design and Technology, is a software analyst with experience in quality assurance, software support, product evangelism, and user engagement. He has written extensively on both the SQL Shack and the ApexSQL Solution Center, on topics ranging from client technologies like 4K resolution and theming, error handling to index strategies, and performance monitoring. Bojan works at ApexSQL in Nis, Serbia as an integral part of the team focusing on designing, developing, and testing the next generation of database tools including MySQL and SQL Server, and both stand-alone tools and integrations into Visual Studio, SSMS, and VSCode. See more about Bojan at LinkedIn View all posts by Bojan Petrovic

168 Views