Merge pull request #1593 from PowerShell/ealexjordan/pscolors

Ealexjordan/pscolors
This commit is contained in:
Alex Jordan
2016-08-03 10:37:20 -07:00
committed by GitHub
3 changed files with 12 additions and 26 deletions
+2 -1
View File
@@ -1484,9 +1484,10 @@ function script:Use-MSBuild {
function script:log([string]$message) {
Write-Host -Foreground Green $message
#reset colors for older package to at return to default after error message on a compiliation error
[console]::ResetColor()
}
function script:precheck([string]$command, [string]$missedMessage) {
$c = Get-Command $command -ErrorAction SilentlyContinue
if (-not $c) {
@@ -1520,16 +1520,11 @@ namespace Microsoft.PowerShell
internal sealed class ConsoleHostRawUserInterface : PSHostRawUserInterface
{
private ConsoleColor _defaultForeground = ConsoleColor.Gray;
private ConsoleColor _defaultBackground = ConsoleColor.Black;
private ConsoleHostUserInterface _parent = null;
internal ConsoleHostRawUserInterface(ConsoleHostUserInterface mshConsole) : base()
{
_defaultForeground = ForegroundColor;
_defaultBackground = BackgroundColor;
_parent = mshConsole;
}
@@ -1539,14 +1534,7 @@ namespace Microsoft.PowerShell
/// </summary>
public override ConsoleColor BackgroundColor
{
get
{
// Console can return UnknownColor, a private enum, equivalent
// to -1. When this is a case, map it instead to our default.
return Console.BackgroundColor == (ConsoleColor)(-1)
? _defaultBackground
: Console.BackgroundColor;
}
get { return Console.BackgroundColor; }
set { Console.BackgroundColor = value; }
}
@@ -1600,14 +1588,7 @@ namespace Microsoft.PowerShell
/// </summary>
public override ConsoleColor ForegroundColor
{
get
{
// Console can return UnknownColor, a private enum, equivalent
// to -1. When this is a case, map it instead to our default.
return Console.ForegroundColor == (ConsoleColor)(-1)
? _defaultForeground
: Console.ForegroundColor;
}
get { return Console.ForegroundColor; }
set { Console.ForegroundColor = value; }
}
@@ -1450,7 +1450,8 @@ namespace Microsoft.PowerShell
set
{ _errorForegroundColor = value; }
}
private ConsoleColor _errorBackgroundColor = ConsoleColor.Black;
private ConsoleColor _errorBackgroundColor = Console.BackgroundColor;
public ConsoleColor ErrorBackgroundColor
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
@@ -1472,7 +1473,8 @@ namespace Microsoft.PowerShell
set
{ _warningForegroundColor = value; }
}
private ConsoleColor _warningBackgroundColor = ConsoleColor.Black;
private ConsoleColor _warningBackgroundColor = Console.BackgroundColor;
public ConsoleColor WarningBackgroundColor
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
@@ -1494,7 +1496,8 @@ namespace Microsoft.PowerShell
set
{ _debugForegroundColor = value; }
}
private ConsoleColor _debugBackgroundColor = ConsoleColor.Black;
private ConsoleColor _debugBackgroundColor = Console.BackgroundColor;
public ConsoleColor DebugBackgroundColor
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
@@ -1516,7 +1519,8 @@ namespace Microsoft.PowerShell
set
{ _verboseForegroundColor = value; }
}
private ConsoleColor _verboseBackgroundColor = ConsoleColor.Black;
private ConsoleColor _verboseBackgroundColor = Console.BackgroundColor;
public ConsoleColor VerboseBackgroundColor
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]