diff --git a/src/Cake.Core/Constants.cs b/src/Cake.Core/Constants.cs index 8da2e1eca7..02d36de3cd 100644 --- a/src/Cake.Core/Constants.cs +++ b/src/Cake.Core/Constants.cs @@ -8,6 +8,8 @@ namespace Cake.Core { internal static class Constants { + public const ConsoleColor DefaultConsoleColor = (ConsoleColor)(-1); + public static readonly Version LatestBreakingChange = new Version(0, 26, 0); public static readonly Version LatestPotentialBreakingChange = new Version(1, 0, 0); diff --git a/src/Cake.Core/Diagnostics/Console/AnsiConsoleRenderer.cs b/src/Cake.Core/Diagnostics/Console/AnsiConsoleRenderer.cs index bdc3556010..1383f6448f 100644 --- a/src/Cake.Core/Diagnostics/Console/AnsiConsoleRenderer.cs +++ b/src/Cake.Core/Diagnostics/Console/AnsiConsoleRenderer.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using Cake.Core.Diagnostics.Console; using Cake.Core.Diagnostics.Formatting; namespace Cake.Core.Diagnostics @@ -25,7 +24,7 @@ public AnsiConsoleRenderer(IConsole console) _ansiLookup = new Dictionary { - { ConsoleColorEx.Default, string.Empty }, // Default + { Constants.DefaultConsoleColor, string.Empty }, // Default { ConsoleColor.DarkGray, "\u001b[30;1m" }, // Bright black { ConsoleColor.Red, "\u001b[31;1m" }, // Bright red { ConsoleColor.Green, "\u001b[32;1m" }, // Bright green @@ -46,7 +45,7 @@ public AnsiConsoleRenderer(IConsole console) _ansiBackgroundLookup = new Dictionary { - { ConsoleColorEx.Default, string.Empty }, // Default + { Constants.DefaultConsoleColor, string.Empty }, // Default { ConsoleColor.DarkGray, "\u001b[40;1m" }, // Bright black { ConsoleColor.Red, "\u001b[41;1m" }, // Bright red { ConsoleColor.Green, "\u001b[42;1m" }, // Bright green diff --git a/src/Cake.Core/Diagnostics/Console/ConsoleColorEx.cs b/src/Cake.Core/Diagnostics/Console/ConsoleColorEx.cs deleted file mode 100644 index 7760423c29..0000000000 --- a/src/Cake.Core/Diagnostics/Console/ConsoleColorEx.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Cake.Core.Diagnostics.Console -{ - internal static class ConsoleColorEx - { - public const ConsoleColor Default = (ConsoleColor)(-1); - } -} diff --git a/src/Cake.Core/Diagnostics/Console/ConsolePalette.cs b/src/Cake.Core/Diagnostics/Console/ConsolePalette.cs index e28906d996..73ae06a266 100644 --- a/src/Cake.Core/Diagnostics/Console/ConsolePalette.cs +++ b/src/Cake.Core/Diagnostics/Console/ConsolePalette.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using Cake.Core.Diagnostics.Console; namespace Cake.Core.Diagnostics { @@ -29,7 +28,7 @@ public static IDictionary CreateLookup(IConsole consol var background = console.BackgroundColor; if ((int)background < 0 || console.SupportAnsiEscapeCodes) { - background = ConsoleColorEx.Default; + background = Constants.DefaultConsoleColor; } return new Dictionary diff --git a/src/Cake.Core/Diagnostics/Console/ConsoleRenderer.cs b/src/Cake.Core/Diagnostics/Console/ConsoleRenderer.cs index fd90b44af8..8959ebbf1e 100644 --- a/src/Cake.Core/Diagnostics/Console/ConsoleRenderer.cs +++ b/src/Cake.Core/Diagnostics/Console/ConsoleRenderer.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using Cake.Core.Diagnostics.Console; using Cake.Core.Diagnostics.Formatting; namespace Cake.Core.Diagnostics @@ -63,24 +62,24 @@ private void SetPalette(FormatToken token, ConsolePalette palette, bool colorize { if (colorize && token is PropertyToken) { - if (palette.ArgumentBackground != ConsoleColorEx.Default) + if (palette.ArgumentBackground != Constants.DefaultConsoleColor) { _console.BackgroundColor = palette.ArgumentBackground; } - if (palette.ArgumentForeground != ConsoleColorEx.Default) + if (palette.ArgumentForeground != Constants.DefaultConsoleColor) { _console.ForegroundColor = palette.ArgumentForeground; } } else { - if (palette.Background != ConsoleColorEx.Default) + if (palette.Background != Constants.DefaultConsoleColor) { _console.BackgroundColor = palette.Background; } - if (palette.Foreground != ConsoleColorEx.Default) + if (palette.Foreground != Constants.DefaultConsoleColor) { _console.ForegroundColor = palette.Foreground; }