Beispiel #1
0
        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));
Beispiel #2
0
        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;
        }
Beispiel #3
0
        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);
            }
        }