Skip to content

Instantly share code, notes, and snippets.

@rkeithhill
Created January 11, 2015 02:36
Show Gist options
  • Save rkeithhill/7a5305d67567effde9d3 to your computer and use it in GitHub Desktop.
Save rkeithhill/7a5305d67567effde9d3 to your computer and use it in GitHub Desktop.
Resets the console background and foreground colors to their startup values
# Certains console exes have a tendency to bork the console colors - looking at you
# MSBuild.exe. Either copy/paste this into your profile.ps1 file or dot source it.
$script:origBgColor = $host.ui.rawui.BackgroundColor
$script:origFgColor = $host.ui.rawui.ForegroundColor
function Reset-Colors
{
$host.ui.rawui.BackgroundColor = $origBgColor
$host.ui.rawui.ForegroundColor = $origFgColor
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment