Skip to Content

How do I change the color of my PowerShell in Windows 11?

Changing the color scheme of PowerShell in Windows 11 can help customize your experience and make the command line interface easier to read or more aesthetically pleasing. PowerShell uses a default blue color scheme, but it’s easy to change with just a few quick steps.

Why Would I Want to Change the PowerShell Colors?

There are a few key reasons why you may want to change the default PowerShell color scheme in Windows 11:

  • Improve readability – Changing the foreground and background colors can help increase the contrast and make text easier to read.
  • Reduce eyestrain – Using softer, lower contrast colors can help reduce eyestrain when working in PowerShell for long periods.
  • Personal preference – You may simply prefer a different color scheme for aesthetic reasons.
  • Customization – Matching PowerShell colors to your overall Windows theme or other apps can provide a more cohesive experience.

Whether you want something more soft and subtle or bold and vivid, customizing the colors allows you to make PowerShell fit your needs and preferences.

How to Change the Default PowerShell Colors

There are just a few simple steps required to change the default color scheme in PowerShell on Windows 11:

  1. Open PowerShell. You can launch it from the Start menu.
  2. At the PowerShell prompt, type: notepad $PROFILE. This will open your PowerShell profile in Notepad.
  3. If the profile doesn’t exist yet, Notepad will show a blank file. Save the blank file as Microsoft.PowerShell_profile.ps1 in the PowerShell installation directory (usually C:\Users\YourUserName\Documents\WindowsPowerShell).
  4. In Notepad, paste the following lines, replacing the colors with your desired hex color codes:


    $Host.PrivateData.ErrorBackgroundColor = "#FFFFFF"
    $Host.PrivateData.ErrorForegroundColor = "#000000"
    $Host.PrivateData.WarningBackgroundColor = "#0000FF"
    $Host.PrivateData.WarningForegroundColor = "#FFFFFF"
    $Host.PrivateData.DebugBackgroundColor = "#00FF00"
    $Host.PrivateData.DebugForegroundColor = "#000000"

  5. Save and close the profile file.
  6. Restart PowerShell to reload the profile and apply your new color settings.

And that’s it! PowerShell should now display with your customized color scheme. Feel free to tweak the hex codes to your liking.

Hex Color Codes for PowerShell

When setting PowerShell colors in your profile, you need to use hex color codes. This allows you to precisely define RGB colors. Here are some examples:

Color Hex Code
Black #000000
White #FFFFFF
Red #FF0000
Green #00FF00
Blue #0000FF

You can find color hex codes online, or use a color picker tool to select a color and get its hex code.

Customizing Other PowerShell Elements

In addition to foreground and background colors, you can also customize other elements of the PowerShell interface:

  • Font family – Set the $Host.PrivateData.FontFamily property to change the font.
  • Font size – Use $Host.PrivateData.FontSize to change the size.
  • Window opacity – Set $Host.PrivateData.WindowOpacity between 0-1 to adjust transparency.
  • Cursor size – Adjust the cursor with $Host.PrivateData.CursorSize.

Play around with different settings to create your ideal customized PowerShell environment!

Other Ways to Customize PowerShell

Changing basic colors and properties through the profile file is the easiest way to customize PowerShell, but there are some other options as well:

  • Use ANSI escape sequences to modify colors and style within the PowerShell session itself.
  • Install a third-party theme, like Oh My Posh or PowerLine, for more advanced customization.
  • Modify the Windows color scheme through the Control Panel to alter the default console colors.
  • Use PowerShell ISE which provides more built-in theming options.

The profile method works well for basic personalization, but you can explore these other options for more control and possibilities.

Resetting PowerShell Colors

If you want to revert PowerShell back to its default blue colors, you have a couple options:

  • Open your PowerShell profile and remove or comment out the color lines you added previously.
  • Delete your PowerShell profile entirely and restart PowerShell to load the defaults.
  • Run Remove-Item $profile to delete the profile file from within PowerShell.

And that’s all it takes to reset to the original blue PowerShell theme!

Conclusion

Customizing your PowerShell colors and theme in Windows 11 is quick and easy. Simply use hex color codes in your PowerShell profile file to change the default blue to your desired scheme. Play around with different color combinations until you find something that works for your eyes and style preferences. Just be sure to use legible foreground and background colors combinations for accessibility. With just a few lines of code, you can give your PowerShell environment a whole new look!