By: Joe Gavin | Updated: 2022-04-18 | Comments (14) | Related: 1 | 2 | 3 | 4 | 5 | 6 | 7 | > SQL Server Management Studio Configuration
Problem
You're using SQL Server Management Studio (SSMS) and would like to use Dark Mode. You've looked at the configuration options and don't see a way to configure it.
Solution
We'll look at some reasons a user would prefer Dark Mode, a brief history of it and how to configure SSMS to add it as an additional Color Theme option.
Reasons for using Dark Mode
While there is no conclusive evidence to support medical claims, these are some of the reasons a user would prefer Dark Mode over Light Mode.
- Less light coming back toward your eyes
- Less glare
- It just looks better to them
- Reduced eye strain
- Less energy used
- Extended laptop battery charge
- Reduced blue light exposure
- Easier to read
- Reduced eye dryness
History of Dark Mode
Before we see how to configure Dark Mode in SSMS, let's look at a brief history of computer displays. Dark Mode simply means a dark, or unlit screen background that is displaying lit up text or graphics. Early computer screens were Cathode Ray Tubes (CRT) that were developed for radar systems during WWII. It simply wasn't practical with this technology to light up an entire screen, so the screen was dark, and the characters were lit up. These screens were Dark Mode even it wasn't referred to by name at the time. They were just called computer screens.
To show how those screens looked, here is a picture of an International Business Machines (IBM) Personal Computer with a monochrome monitor and an Applied Digital Data Systems (ADDS) Viewpoint dumb terminal. Text was displayed in green (and sometimes in amber or white) on a dark unlit background. Both date back to the 1980s.
As color monitors and graphics video cards became the norm and CRTs gave way to Liquid Crystal Displays (LCD), text and graphics were able to be displayed on a white background to look more like a page printed on paper. And as with so many things, it's gone full circle and Dark Mode has come back into fashion. What's old becomes what's new again.
How to Enable Dark Theme in SSMS
Before we configure SSMS for Dark Mode, we need to note that it's not something officially supported by Microsoft at this time. Let's hope it is in the future.
The Dark Mode option has been available since SSMS 16, but is disabled by default.
First, let's open SSMS and look at the existing color schemes available.
- Tools
- Options…
- Environment
- General
- Expand 'Color theme' dropdown
And we see the default of Blue, Blue (Extra Contrast), and Light.
- Blue – default color scheme
- Blue (Extra Contrast) - indistinguishable from Blue
- Light – blue areas become grayish for very little contrast
We're going to be adding a fourth option to that list.
Close SSMS.
We're going to be making an edit to a file called ssms.pkgundef. Before we continue, let's look at what pkgundef files are. Pkgundef files are generated by Microsoft Visual Studio. They are used to remove features from an application by deleting specific registry keys. Essentially, when an application is started the feature is enabled then disabled. This is reason you'll see the reverse logic of enabling a feature by commenting it out.
Now, find the ssms.pkgundef configuration file. The following table has the default file location depending on your SSMS version.
SSMS Version | Ssms.pkgundef File Location |
---|---|
16 | C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio |
17 | C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio |
18 | C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE |
Hopefully you've been keeping up with updates and are using at least SSMS 18 and will find the file in C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE. I'm using SSMS 18.11.1 which is the latest version as of the time of writing to write this tip.
Open the text editor of your choosing as Administrator. Running as Administrator will avoid permission problems when you save the file.
- Yes, if prompted by UAC
- Browse to folder containing ssms.pkgundef
- All Files
- Select ssms.pkgundef
- Open
- Scroll until you get to '// Remove Dark theme'
- Add '//' to the beginning of the '[$RootKey$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' line to comment it out
- Save the file
Alternatively, you may prefer to run a script rather than manually editing the ssms.pkgundef file. The following PowerShell will search each of the three default SSMS install directories for ssms.pkgundef and will add the two forward slashes '//' in front of the '[$RootKey$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' line to comment it out. Remember to run it as Administrator.
# original script https://dba.stackexchange.com/questions/295714/changing-ssms-settings-via-powershell # ssms 16 If (Test-Path 'C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.pkgundef') { powershell -Command "(Get-Content '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\130\Tools\Binn\ManagementStudio\ssms.pkgundef'" } # ssms 17 ElseIf (Test-Path 'C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\ssms.pkgundef') { powershell -Command "(Get-Content '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 ElseIf (Test-Path 'C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.pkgundef') { powershell -Command "(Get-Content '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'" } Else {Write-Output 'ssms.pkgundef not found'}
Reopen SSMS and navigate to the 'Color theme' dropdown as we did earlier. Now, we will see a fourth option for Dark Mode.
- Select Dark
- OK
Here is what SSMS dark theme looks like now now:
Unfortunately, it only changes the Ribbon and the Query Window. The Object Explorer and Results Grid aren't changed. But if you're primarily in the Query Window to write T-SQL scripts and stored procedures, you get this experience.
Also, this change will be overwritten when you upgrade SSMS but as you've seen the change is easy to make.
You've likely configured Dark Mode in SSMS because you're a fan of it. But if you decide you don't like it it's a simple matter to change it to one of the other three options.
Next Steps
- If you're looking for additional SSMS tips to help manage your SQL database, you can find a wealth of them here: SQL Server Management Studio Tips.
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2022-04-18