Respect Console.BackGround color

This was bugging me. Instead of using the existing console's background
color, we were hard-coding "Black." Now we just leave it alone.
This commit is contained in:
Andrew Schwartzmeyer
2016-02-22 11:29:03 -08:00
parent b143465401
commit 56ed87c108
2 changed files with 12 additions and 13 deletions
+1 -1
View File
@@ -518,7 +518,7 @@ OPTIONS
prompt = "PS> ";
}
this.myHost.UI.Write(ConsoleColor.White, ConsoleColor.Black, prompt);
this.myHost.UI.Write(ConsoleColor.White, Console.BackgroundColor, prompt);
string cmd = consoleReadLine.Read(this.myHost.Runspace);
this.Execute(cmd);
}
+11 -12
View File
@@ -54,7 +54,7 @@ namespace Microsoft.PowerShell.Linux.Host
{
this.Write(
ConsoleColor.White,
ConsoleColor.Black,
Console.BackgroundColor,
caption + System.Environment.NewLine + message + " ");
Dictionary<string, PSObject> results =
new Dictionary<string, PSObject>();
@@ -96,7 +96,7 @@ namespace Microsoft.PowerShell.Linux.Host
// Write the caption and message strings in Blue.
this.WriteLine(
ConsoleColor.Blue,
ConsoleColor.Black,
Console.BackgroundColor,
caption + System.Environment.NewLine + message + System.Environment.NewLine);
// Convert the choice collection into something that is
@@ -124,7 +124,7 @@ namespace Microsoft.PowerShell.Linux.Host
// chosen, or the loop is interrupted with ctrl-C.
while (true)
{
this.WriteLine(ConsoleColor.Cyan, ConsoleColor.Black, sb.ToString());
this.WriteLine(ConsoleColor.Cyan, Console.BackgroundColor, sb.ToString());
string data = Console.ReadLine().Trim().ToUpper();
// If the choice string was empty, use the default selection.
@@ -170,7 +170,7 @@ namespace Microsoft.PowerShell.Linux.Host
// Write the caption and message strings in Blue.
this.WriteLine(
ConsoleColor.Blue,
ConsoleColor.Black,
Console.BackgroundColor,
caption + System.Environment.NewLine + message + System.Environment.NewLine);
// Convert the choice collection into something that is
@@ -217,7 +217,7 @@ namespace Microsoft.PowerShell.Linux.Host
this.WriteLine(
ConsoleColor.Cyan,
ConsoleColor.Black,
Console.BackgroundColor,
sb.ToString());
// Read prompts until a match is made, the default is
// chosen, or the loop is interrupted with ctrl-C.
@@ -226,7 +226,7 @@ namespace Microsoft.PowerShell.Linux.Host
{
ReadNext:
string prompt = string.Format(CultureInfo.CurrentCulture, "Choice[{0}]:", results.Count);
this.Write(ConsoleColor.Cyan, ConsoleColor.Black, prompt);
this.Write(ConsoleColor.Cyan, Console.BackgroundColor, prompt);
string data = Console.ReadLine().Trim().ToUpper();
// If the choice string was empty, no more choices have been made.
@@ -352,7 +352,6 @@ ReadNext:
Console.ForegroundColor = foregroundColor;
Console.BackgroundColor = backgroundColor;
Console.Write(value);
//Console.Write(value);
Console.ResetColor();
}
@@ -361,7 +360,7 @@ ReadNext:
/// Writes a line of characters to the output display of the host
/// with foreground and background colors and appends a newline (carriage return).
/// </summary>
/// <param name="foregroundColor">The forground color of the display. </param>
/// <param name="foregroundColor">The foreground color of the display. </param>
/// <param name="backgroundColor">The background color of the display. </param>
/// <param name="value">The line to be written.</param>
public override void WriteLine(
@@ -383,7 +382,7 @@ ReadNext:
{
this.WriteLine(
ConsoleColor.Yellow,
ConsoleColor.Black,
Console.BackgroundColor,
String.Format(CultureInfo.CurrentCulture, "DEBUG: {0}", message));
}
@@ -396,7 +395,7 @@ ReadNext:
{
this.WriteLine(
ConsoleColor.Red,
ConsoleColor.Black,
Console.BackgroundColor,
value);
}
@@ -454,7 +453,7 @@ ReadNext:
{
this.WriteLine(
ConsoleColor.Green,
ConsoleColor.Black,
Console.BackgroundColor,
String.Format(CultureInfo.CurrentCulture, "VERBOSE: {0}", message));
}
@@ -466,7 +465,7 @@ ReadNext:
{
this.WriteLine(
ConsoleColor.Yellow,
ConsoleColor.Black,
Console.BackgroundColor,
String.Format(CultureInfo.CurrentCulture, "WARNING: {0}", message));
}