From b1522d2f2ab1cf4e444a94d8411c8523903fb7ea Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Fri, 29 Aug 2014 18:37:42 -0700 Subject: [PATCH] Vary color scheme depending on background --- src/nunit-console/Utilities/ColorConsole.cs | 106 +++++++++++++++----- 1 file changed, 83 insertions(+), 23 deletions(-) diff --git a/src/nunit-console/Utilities/ColorConsole.cs b/src/nunit-console/Utilities/ColorConsole.cs index 38c1b9a0..50cd365e 100644 --- a/src/nunit-console/Utilities/ColorConsole.cs +++ b/src/nunit-console/Utilities/ColorConsole.cs @@ -149,31 +149,91 @@ namespace NUnit.ConsoleRunner.Utilities /// public static ConsoleColor GetColor(ColorStyle style) { - switch (style) + switch (Console.BackgroundColor) { - case ColorStyle.Header: - return ConsoleColor.White; - case ColorStyle.SubHeader: - return ConsoleColor.Gray; - case ColorStyle.SectionHeader: - return ConsoleColor.Cyan; - case ColorStyle.Label: - return ConsoleColor.Green; - case ColorStyle.Value: - return ConsoleColor.White; - case ColorStyle.Pass: - return ConsoleColor.Green; - case ColorStyle.Failure: - return ConsoleColor.Red; - case ColorStyle.Warning: - return ConsoleColor.Yellow; - case ColorStyle.Error: - return ConsoleColor.Red; - case ColorStyle.Output: - return ConsoleColor.Gray; - case ColorStyle.Default: + case ConsoleColor.White: + switch (style) + { + case ColorStyle.Header: + return ConsoleColor.DarkBlue; + case ColorStyle.SubHeader: + return ConsoleColor.DarkGray; + case ColorStyle.SectionHeader: + return ConsoleColor.DarkBlue; + case ColorStyle.Label: + return ConsoleColor.DarkGreen; + case ColorStyle.Value: + return ConsoleColor.Blue; + case ColorStyle.Pass: + return ConsoleColor.Green; + case ColorStyle.Failure: + return ConsoleColor.Red; + case ColorStyle.Warning: + return ConsoleColor.Yellow; + case ColorStyle.Error: + return ConsoleColor.Red; + case ColorStyle.Output: + return ConsoleColor.DarkGray; + case ColorStyle.Default: + default: + return ConsoleColor.Green; + } + + case ConsoleColor.Gray: + switch (style) + { + case ColorStyle.Header: + return ConsoleColor.White; + case ColorStyle.SubHeader: + return ConsoleColor.DarkGray; + case ColorStyle.SectionHeader: + return ConsoleColor.Cyan; + case ColorStyle.Label: + return ConsoleColor.Green; + case ColorStyle.Value: + return ConsoleColor.White; + case ColorStyle.Pass: + return ConsoleColor.Green; + case ColorStyle.Failure: + return ConsoleColor.Red; + case ColorStyle.Warning: + return ConsoleColor.Yellow; + case ColorStyle.Error: + return ConsoleColor.Red; + case ColorStyle.Output: + return ConsoleColor.DarkGray; + case ColorStyle.Default: + default: + return ConsoleColor.Green; + } + default: - return ConsoleColor.Green; + switch (style) + { + case ColorStyle.Header: + return ConsoleColor.White; + case ColorStyle.SubHeader: + return ConsoleColor.Gray; + case ColorStyle.SectionHeader: + return ConsoleColor.Cyan; + case ColorStyle.Label: + return ConsoleColor.Green; + case ColorStyle.Value: + return ConsoleColor.White; + case ColorStyle.Pass: + return ConsoleColor.Green; + case ColorStyle.Failure: + return ConsoleColor.Red; + case ColorStyle.Warning: + return ConsoleColor.Yellow; + case ColorStyle.Error: + return ConsoleColor.Red; + case ColorStyle.Output: + return ConsoleColor.Gray; + case ColorStyle.Default: + default: + return ConsoleColor.Green; + } } }