Get Solarized – Awesome command prompt colors for VS, VS Code, cmd, PowerShell, and more

Dev Tips


I was on a call with my co-worker Maria today and she commented on how nice my command prompt in Windows looked. I told it was “Solarized” and then our conference call fell apart as we collected all kinds of fun info about how you can get Solarized in your favorite apps on Windows.

Solarized is a sixteen color palette (eight monotones, eight accent colors) designed for use with terminal and gui applications. It’s by Ethan Schoonover and it’s spread all over the web. You can see screenshots and learn about it on GitHub.

Solarized for your Windows Command Prompt (cmd, powershell, bash)

By default when you right click and hit properties on a shortcut for a prompt like cmd, powershell, or bash, you’ll get a dialog that looks like this.

Default Colors in CMD

You’ll see there’s 16 colors, usually 8 colors on the left, and then the “light/intense/bold” version of each color on the right. I usually used Intense Terminal Green on black before Solarized.

Those values (the defaults) are stored in the registry here HKEY_CURRENT_USERConsole

Where default colors are stored in the Registry

Those defaults are used for NEW shortcuts or consoles that start afresh, via Windows+R. This won’t change existing shortcuts you may already have created. There’s a few ways to fix this.

I’ve found the easiest manual way is to recreate the shortcuts. You can do this by just copy-pasting a shortcut and using the new one.

However, there is talk of programmatically updating .lnk (Start Menu link files) with PowerShell.

You’d just go to the location of each LNK file you want to change, then run Update-Link.ps1 YOURLINK.LNK “light|dark” and it’ll load up the .lnk file using Windows APIs and save it with a new Color Table.

I’ve started that work here and I’ll PR the main repo if I can solve one issue – I can’t get it to switch to Solarized Light, just Dark. It might be something wrong on my side. Please take a look if you’re a Win32/PowerShell internals type.

Here I went to where the Start Menu stores most of the LNK files. You can also search for an item in your start and right-click “Open File Location.”pow

Programatically Update your LNKs with PowerShell

Here’s before and after with my Developer Command Prompt for Visual Studio 2015.

Solarized!

NOTE: Once this is done, in cmd.exe you can also switch between light and dark with “color f6” or “color 01” which is nice for presentations. I’m not sure how to do this yet in PowerShell or Bash.

Here is the palette after:

Solarized Palette

For PowerShell there is also an extra-step you’ll want to put into your Microsoft.PowerShell_profile.ps1 where you map things like Errors, Progress Bars, and Warnings internally in PowerShell. Be sure to read the instructions.

Solarized in Visual Studio and Visual Studio Code

As for Visual Studio and Visual Studio Code, they’re far easier. You can just Ctrl-K then Ctrl-T in VSCode and pick Solarized.

Solarized in VS Code

For Visual Studio (all versions) you can head over to @leddt’s GitHub and download settings files for Solarized that you can then import info VS from Tools | Import and Export Settings.


Sponsor: Big thanks to Raygun! Don’t rely on your users to report the problems they experience. Automatically detect, diagnose and understand the root cause of errors, crashes and performance issues in your web and mobile apps. Learn more.
















Source link

Leave a Reply