SQL Server Management Studio Dark Mode

By:   |   Updated: 2022-04-18   |   Comments (6)   |   Related: > 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.

IBM PC with a monochrome monitorADDS Viewpoint Dumb Terminal

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.

  1. Tools
  2. Options…
SSMS Options
  1. Environment
  2. General
  3. Expand 'Color theme' dropdown
SSMS Color Theme

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.

Text Editor
  1. Yes, if prompted by UAC
UAC
  1. Browse to folder containing ssms.pkgundef
  2. All Files
  3. Select ssms.pkgundef
  4. Open
Open ssms.pkgundef
  1. Scroll until you get to '// Remove Dark theme'
  2. Add '//' to the beginning of the '[$RootKey$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' line to comment it out
Edit File
  1. Save the file
Save 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'} 
Editing ssms.pkgundef with PowerShell

Reopen SSMS and navigate to the 'Color theme' dropdown as we did earlier. Now, we will see a fourth option for Dark Mode.

Added Theme
  1. Select Dark
  2. OK
Choose Dark Mode

Here is what SSMS dark theme looks like now now:

SSMS Dark Mode

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.

SSMS Dark Mode with Object Explorer Unpinned

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





get scripts

next tip button



About the author
MSSQLTips author Joe Gavin Joe Gavin is from Greater Boston. He has held many roles in IT and is currently a SQL Server Database Administrator.

View all my tips


Article Last Updated: 2022-04-18

Comments For This Article




Thursday, November 10, 2022 - 9:18:49 AM - DB Back To Top (90678)
They don't include dark mode so you'll switch to Azure Dev Studio, which I dislike. But I'm old.

Friday, September 2, 2022 - 10:39:21 AM - Joe Gavin Back To Top (90438)
Thanks for the comments Miguel. I love writing about simple things that are helpful.

Friday, September 2, 2022 - 5:59:03 AM - Miguel Cramer Back To Top (90435)
I just installed SSMS 19 on Preview and Dark theme looks great with your hack! Thank so much, Joe! I love working in dark theme, almost as much as I love simple hacks like this. For years I've struggled setting the entire PC on High Contrast, but that makes selecting and other views difficult. I've even gone through the wysiwyg fudge back in 1992, i.e. before Windows on DOS, and hated it. But everyone is still stuck on first gear on Lotus 1-2-3 for DOS. Even people that were not even born back then. You know, leaving margins on the left and top of an Excel Spreadsheet, agonising with the A1 notation when R1C1 makes more sense. It's like the story of "Mom, why do we have to cut the back end chicken to roast it?" Mom: "your great grandma said that's how's done. End of." It turns out great grandma only had a tiny roasting pan...

Monday, August 1, 2022 - 4:47:08 PM - Victoria Back To Top (90328)
Thanks : )

Tuesday, April 19, 2022 - 12:18:09 PM - Tony Back To Top (90019)
The colors of text and the background in the object explorer have no contrast between them it's hard to read the text. Also the results pane is not dark. The dark theme is pretty much useless. This looks like still a work in progress. Otherwise MS would have released it.

Monday, April 18, 2022 - 3:54:55 PM - Bryan Jenks Back To Top (90015)
What i dont get is why they wont just put in a dang darkmode yet, why make people edit this obscure file to access the darkmode >.>














get free sql tips
agree to terms