Bojan Petrovic

Setting up the dark theme in SQL Server management studio

September 28, 2017 by

In SSMS 2016 Microsoft introduced visual setting option to choose between Blue and Light color theme. In both SSMS 2016 and the latest SSMS 17, the user can switch between the Blue or Light theme by going to Tools > Options > Environment > General > Color theme:

SSMS Dark theme

Although it’s not officially supported by Microsoft, the Dark theme is also available in both SSMS 2016 and the latest SSMS 17. The dark theme has been very popular among SQL database administrators and developers. To enable the Dark theme in SSMS, 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:

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

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

Once the file is opened in the text editor, scroll down and find 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:

Once completed, start SSMS and the Dark color theme will be available in the SSMS Color theme drop-down box:

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 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:

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:

Depending on the version of SSMS, copy the appropriate script into the clipboard and hit Enter to run 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'"

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:

Note: As we mentioned before, the Dark color theme in SSMS 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

See more

To boost your SQL Server development productivity, check out Free SQL Server Management Studio add-ins.

References


Bojan Petrovic

Bojan Petrovic

Bojan has a passion for working with computers, servers, and network technology, and electronics. He likes to stay updated with developments and the most recent technology. He currently works at ApexSQL LLC as a Support Engineer with a bachelor’s degree in IT Network and Electronics Technology.

He helps customers with any technical issues and does quality assurance (testing applications and preparing for production) for ApexSQL Complete, ApexSQL Refactor, and ApexSQL Search free add-ins.

View all posts by Bojan Petrovic
Bojan Petrovic

Latest posts by Bojan Petrovic (see all)

SQL Server Management Studio (SSMS)

About Bojan Petrovic

Bojan has a passion for working with computers, servers, and network technology, and electronics. He likes to stay updated with developments and the most recent technology. He currently works at ApexSQL LLC as a Support Engineer with a bachelor’s degree in IT Network and Electronics Technology. He helps customers with any technical issues and does quality assurance (testing applications and preparing for production) for ApexSQL Complete, ApexSQL Refactor, and ApexSQL Search free add-ins. View all posts by Bojan Petrovic

69,092 Views