From d9982f98e60d516898e855cc32757c4bc55aac38 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Thu, 21 Jul 2022 02:28:25 -0500 Subject: [PATCH] Fix colored console printer to correctly handle multiline darkened messages --- IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs b/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs index e6415018..35abbd45 100644 --- a/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs +++ b/IPA.Loader/Logging/Printers/ColoredConsolePrinter.cs @@ -66,13 +66,19 @@ namespace IPA.Logging.Printers SetColor(Color, WinConsole.OutHandle); var prefixStr = ""; + var suffixStr = ""; if ((darkenSetManually && darkenMessages) || (!darkenSetManually && Config.SelfConfig.Debug_.DarkenMessages_)) { - prefixStr = StdoutInterceptor.ConsoleColorToForegroundSet(GetDarkenedColor(Color)); + var darkened = GetDarkenedColor(Color); + if (darkened != Color) + { + prefixStr = StdoutInterceptor.ConsoleColorToForegroundSet(darkened); + suffixStr = StdoutInterceptor.ConsoleColorToForegroundSet(Color); + } } foreach (var line in message.Split(new[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) - WinConsole.ConOut.WriteLine(Logger.LogFormat, prefixStr + line, logName, time, level.ToString().ToUpperInvariant()); + WinConsole.ConOut.WriteLine(Logger.LogFormat, prefixStr + line + suffixStr, logName, time, level.ToString().ToUpperInvariant()); ResetColor(WinConsole.OutHandle); }