How can I reset the powershell colors

50,222

Solution 1

This resets the console colors (e.g., [Console]::BackgroundColor): (Paste in the powershell console)

[Console]::ResetColor()

Solution 2

I realize this is an old question, but I found it in Google and have another solution.

Set-PSReadlineOption -TokenKind Command -ForegroundColor Black

Source

This will change the input text to black. The available color choices are as follows:

  • Black
  • DarkBlue
  • DarkGreen
  • DarkCyan
  • DarkRed
  • DarkMagent
  • DarkYellow
  • Gray
  • DarkGray
  • Blue
  • Green
  • Cyan
  • Red
  • Magenta
  • Yellow
  • White

You can make this persist by adding it to your profile. It's enough to append the command to the end of the file.

In my case the profile is in: C:\Users\Billy\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

To get the location of your PS profile type:

$profile

If this file doesn't exist, you can create it with:

New-item –type file –force $profile

(source)

To see the current settings in your profile, use:

Get-PSReadlineOption

(source)

Solution 3

The colors you see by right clicking on the title bar and clicking on Properties are actually stored in the shortcut file itself in the ExtraData section. You can just delete shortcut and recreate it, or you can use a hex editor to change the values. Outside of that, there is not "reset" feature. This is also true for the normal command prompt.

010 Editor Screenshot

Solution 4

Edit: as pointed out by @dhobbs in the comments, this is no longer an option in PowerShell 6: https://docs.microsoft.com/en-us/powershell/module/PSReadline/Set-PSReadlineOption?view=powershell-6.

Resetting the PowerShell console colors to their defaults can be done with the following command:

Set-PSReadlineOption -ResetTokenColors 

Documentation here: https://msdn.microsoft.com/en-us/powershell/reference/5.1/psreadline/set-psreadlineoption

Add the line to your PowerShell profile to make it have the command run each time a PowerShell console is opened. To see the location of your PowerShell profile, from a PowerShell console type:

$profile

Solution 5

Stolen from Xin, but I cannot comment so you're going to have to accept that

[Console]::ResetColor()

then clear the screen to let the change take effect.

clear

I think that was the problem bucky was having with the previous answer.

Hope this helped!

Share:
50,222
elvaqueroloconivel1
Author by

elvaqueroloconivel1

Updated on March 07, 2020

Comments

  • elvaqueroloconivel1
    elvaqueroloconivel1 over 4 years

    I changed the colors of the powershell and now I can't change the color of the input text, is always yellow.

    I changed the color of the background and the color of the text

    changing colors

    The color of the background changed correctly but in the display text the color still is yellow.

    changed

    Can I do something to reset the colors?