public static ConsoleOutputSink Create(bool noColor, bool acceptsVerboseMessages) { var textColorsTheme = TextColorsTheme.GetForCurrentOS(); var(foregroundColor, backgroundColor) = GetForegroundAndBackgroundColor(); var textColors = new TextColors(textColorsTheme, foregroundColor, backgroundColor, noColor); return(new ConsoleOutputSink(textColors, acceptsVerboseMessages));
public ConsoleOutputSink(TextColors textColors, bool acceptsVerboseMessages) { System.Diagnostics.Debug.Assert(textColors != null); this.textColors = textColors ?? new TextColors( TextColorsTheme.GetForCurrentOS(), ConsoleColor.Gray, ConsoleColor.Black, false); this.acceptsVerboseMessages = acceptsVerboseMessages; }
public TextColors(TextColorsTheme textColorsTheme, ConsoleColor foregroundColor, ConsoleColor backgroundColor, bool noColor) { System.Diagnostics.Debug.Assert(textColorsTheme != null); Background = backgroundColor; Message = foregroundColor; Warning = foregroundColor; Error = foregroundColor; Confirmation = foregroundColor; if (noColor) { return; } if (textColorsTheme != null) { Warning = textColorsTheme.GetWarningColorFor(foregroundColor, backgroundColor); Error = textColorsTheme.GetErrorColorFor(foregroundColor, backgroundColor); Confirmation = textColorsTheme.GetConfirmationColorFor(foregroundColor, backgroundColor); } }