How to Change Windows PowerShell Color Scheme on Windows 10

The first ever Windows PowerShell was released over a decade ago for Windows XP, Windows Server 2003 and Windows Vista. It’s been a constant part of all Windows editions since then, starting with Windows 7 in 2009. While there have been many changes made to the software itself, the one thing that has stayed unchanged over the years is the color scheme – a blue background with white/yellow text in general, and red text on a black background for error messages. While most people have gotten used to these colors, some of you may want something more distinctive, either for better visibility or for aesthetic reasons. That being the case, let’s talk a look at how you can change Windows PowerShell color scheme in Windows 10:

Note: Before we proceed, it’s important to understand that this particular tutorial will deal with the PowerShell console, and not the PowerShell ISE, which is one of the two host applications for Windows PowerShell engine and language. It has it’s own customization settings that need to be tackled separately, and is beyond the scope of this tutorial.

Change Background and Foreground Colors in Windows 10 PowerShell Console

  • As mentioned earlier, Windows PowerShell console displays white on blue by default and red on black for error messages, so to change colors, right-click on the PowerShell Window top-bar, and select ‘Properties’.

How to Change Windows PowerShell Color Scheme on Windows 10

  • Once the Windows PowerShell ‘Properties’ box pops up, click on the ‘Colors’ tab, and you’ll get a whole host of choices to set background and foreground colors as seen in the screenshot below.

From here, you can change text colors, popup text colors, background colors and even set the opacity levels.

Change Error Message Colors in Windows 10 PowerShell Console

  • While this was a really easy way to change some of the settings, what if you want to do more extensive changes to your PowerShell console? For example, what if you want to change the text and background colors of error messages from red on black to something a little less drastic? For that, you’ll need to get down and dirty and use the console itself rather than rely on GUI. First off, to know the default colors, go ahead and copy/paste this code on the PowerShell console and press ‘Enter’: $host.privatedata

  • To change the foreground and background colors of error messages, all you need to do is assign new values. Since I’d like to change the background color to ‘Magenta’ and foreground color to ‘Green’, I’ll input the two commands below. Just remember to enter them separately and press ‘Enter’ in each case.
    $host.PrivateData.ErrorBackgroundColor = "Magenta"

    $host.PrivateData.ErrorForegroundColor = "Green"

  • You have now configured your console settings, but you’ll need to save them to your profile settings so that the screen opens up exactly as you want it to, every time. For that, first run the command $profile. This will show you the name (and location) of the default file for your profile.

  • In reality, though, the default PowerShell configuration file does not even exist in most cases. So run the following command to check if it already exists or if you need to create it from scratch: test-path $profile. If the file already exists, you’ll get a “True” output, else, you’ll get “False”.

  • As you can see from the above screenshot, I got the latter, so I’ll need to create the file. If you get “True”, skip this step and go to the next. Else, enter the following command to create the file: New-Item -path $profile -type file -force

  • Once the file is created, you can easily edit it with Notepad by using the notepad $profile command in the Powershell Window. From there, you can add whatever configuration code you want to using the commands discussed above. You can not only change colors, but also fonts, windows size, etc through this method, but we’re only going to take a look at changing colors without complicating matters any further.

    $console = $host.ui.rawui
    $console.backgroundcolor = "black"
    $console.foregroundcolor = "white"
    $colors = $host.privatedata
    $colors.verbosebackgroundcolor = "Magenta"
    $colors.verboseforegroundcolor = "Green"
    $colors.warningbackgroundcolor = "Red"
    $colors.warningforegroundcolor = "white"

    $colors.ErrorBackgroundColor = "DarkCyan"
    $colors.ErrorForegroundColor = "Yellow"
    set-location C:\
    clear-host

  • We’re almost there, but there’s one last step. Run the following command to permit local scripts to run on your system: Set-ExecutionPolicy RemoteSigned and select “A” to allow all scripts. Now that you’re done, this is how your PowerShell console would look every time you start it up. Even the errors messages would look a little less jarring than they normally do.

That’s it, folks, I’ve made the Windows PowerShell console on my work laptop look almost exactly like the good old Command Prompt with just a dash of color thrown in for fun.

Note: While the aforementioned steps are meant specifically for Windows 10, I also tried them out on our older Dell desktop running Windows 7. Every step is pretty much identical, and every thing worked as expected.

SEE ALSO: How to Stop Windows 10 Updates From Installing Automatically

Use Simple Commands To Change Windows PowerShell Colors in Windows 10

The Windows PowerShell is a great tool for power users but that doesn’t mean it has to be dull, drab and boring. Tweaking a few setting here and there can make a world of difference to how your PowerShell console looks, so give it a go and change the colors to whatever your heart feels like. And once you do that, don’t forget to give us a heads-up about how things went, because we love hearing from you.

Comments 14
  • John Doe says:

    For those of you that happen to stumble across this outdated, poorly-written “tutorial”, here is what works regarding saving your profile. Just paste in the code the same as you would within PowerShell itself. For example:

    Set-PSReadLineOption -Colors @{ “ListPrediction”=”White” }
    Set-PSReadLineOption -Colors @{ “String”=”White” }
    Set-PSReadLineOption -Colors @{ “Operator”=”White” }
    Set-PSReadLineOption -Colors @{ “Parameter”=”White” }
    Set-PSReadLineOption -Colors @{ “InlinePrediction”=”White” }

    You don’t need the “set-location C:\ clear-host” stuff at all. My PowerShell pops up normally and has all the custom settings I changed.

  • John Doe says:

    Not sure what was going on on your end, but I never got the ability to “select ‘A’ ” after the Set-ExecutionPolicy RemoteSigned command. Also, you left a few things out, such as not mentioning to save the profile that is opened up in Notepad before running the command.

  • Nasrul Islam says:

    Awesome. Very easy

  • ??? says:

    Change background color
    $Host.PrivateData.ConsolePaneBackgroundColor = “Red”

  • Yrt Yari says:

    Hi Kishalaya Kundu,
    please, how is it possible to revert to previous state after having applied: “Set-ExecutionPolicy RemoteSigned and select “A” ?
    Thanks in advance.

    Yrt

  • Subbu says:

    Hi Kishalaya Kundu,
    I want to change the command color. how can i do it.
    Example: ls subbu –> i want to change the color of ls command to black.

    Thanks,
    subbu

    • Kishalaya Kundu says:

      Hi Subbu, you can use the following command: Set-PSReadLineOption -colors @{ Command = “Black”}

      • John says:

        but that only changes it in the console for that one session, when you re-open the console, it reverts back to what it was. What line would you have to add in the profile in order to make it permanent?

  • Dave says:

    I’m seeing some text in Red which is not the current selected color for my text. That would be white. I don’t like the red, how can I change that to something easier on the eye?

    • Kishalaya Kundu says:

      Hi Dave, you can change the background and text colors by following the first two steps of the tutorial.

  • San says:

    Great! Thank you! That´s what I was looking for!

  • mark says:

    This is exceptional quality documentation.

  • James says:

    Nicely explained. Exactly what I needed. Thanks.

  • Rajan says:

    Very good solution.

Leave a Reply