public ConsolePixel(ConsoleColor backgroundColor, ConsoleColor foregroundColor, char printableCharacter)
        {
            BackgroundColor = backgroundColor;
            ForegroundColor = foregroundColor;
            PrintableCharacter = printableCharacter;

            _percent = _percents.ContainsKey(printableCharacter) ? _percents[printableCharacter] : (byte)0;

            Color color1 = backgroundColor.ToColor();
            Color color2 = foregroundColor.ToColor(); ;

            Color = color1.Blend(color2, (double)_percent);
        }
Exemple #2
0
        public void Write(string str, ConsoleColor fore, ConsoleColor back)
        {
            if (_disposed)
            {
                return;
            }
            if (String.IsNullOrEmpty(str))
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(() => Write(str, fore, back)));
                return;
            }

            Write(str, FontStyle.Bold, fore.ToColor(), back.ToColor());
        }
 /// <summary>
 /// Sets the color of the text.
 /// </summary>
 /// <param name="color">The color.</param>
 private void SetTextColor( ConsoleColor color )
 {
     this.TextBox.SelectionColor = color.ToColor ( );
 }
Exemple #4
0
        public void Write(string str, ConsoleColor fore, ConsoleColor back)
        {
            if (_disposed)
            {
                return;
            }
            if (String.IsNullOrEmpty(str))
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(() => Write(str, fore, back)));
                return;
            }

            Write( str, FontStyle.Bold, fore.ToColor(), back.ToColor());
        }
 public void ConsoleColorToColor(ConsoleColor target, uint expected)
 => Equal(Color.FromArgb((int)expected), target.ToColor());
Exemple #6
0
 private void LogLine(ConsoleColor color, string value)
 {
     BTSDeployForm.DeployForm.SetOutputTextBoxColorDelegate optDelegate =
         new BTSDeployForm.DeployForm.SetOutputTextBoxColorDelegate(_gui.SetOutputTextBoxColor);
     _gui.OutputTextBox.Invoke(optDelegate, new object[] { color.ToColor(), value + Environment.NewLine });
 }
 protected override void PrintColoredLine(ConsoleColor foregroundColor, ConsoleColor backgroundColor, string text) =>
 base.PrintLine(text.ColorText(foregroundColor.ToColor())
                .BgColorText(backgroundColor.ToColor()));
 protected override void PrintBackgroundColoredLine(ConsoleColor color, string text) =>
 base.PrintLine(text.BgColorText(color.ToColor()));
 public override void PrintColoredLine(ConsoleColor color, string text) =>
 base.PrintLine(text.ColorText(color.ToColor()));
Exemple #10
0
 /// <summary>
 /// Sets the color of the text.
 /// </summary>
 /// <param name="color">The color.</param>
 private void SetTextColor(ConsoleColor color)
 {
     this.TextBox.SelectionColor = color.ToColor( );
 }