private static Brush GetZColorBrush(ZColor color) { switch (color) { case ZColor.Black: return Brushes.Black; case ZColor.Blue: return Brushes.Blue; case ZColor.Cyan: return Brushes.Cyan; case ZColor.Gray: return Brushes.Gray; case ZColor.Green: return Brushes.Green; case ZColor.Magenta: return Brushes.Magenta; case ZColor.Red: return Brushes.Red; case ZColor.White: return Brushes.White; case ZColor.Yellow: return Brushes.Yellow; default: throw new ArgumentException("Unexpected color: " + color, "color"); } }
private Brush GetZColorBrush(ZColor color) { switch (color) { case ZColor.Black: return(Brushes.Black); case ZColor.Red: return(Brushes.Red); case ZColor.Green: return(Brushes.Green); case ZColor.Yellow: return(Brushes.Yellow); case ZColor.Blue: return(Brushes.Blue); case ZColor.Magenta: return(Brushes.Magenta); case ZColor.Cyan: return(Brushes.Cyan); case ZColor.White: return(Brushes.White); case ZColor.Gray: return(Brushes.Gray); default: throw new ArgumentException("Unexpected color: " + color, "color"); } }
public void SetBackgroundColor(ZColor color) { var brush = color == ZColor.Default ? FontsAndColorsService.DefaultBackground : GetZColorBrush(color); FontsAndColorsService.Background = brush; }
void IScreen.SetBackgroundColor(ZColor color) { Dispatch(() => { var brush = color == ZColor.Default ? FontsAndColorsService.DefaultBackground : GetZColorBrush(color); FontsAndColorsService.Background = brush; }); }
internal void SetColors(ZColor foreground, ZColor background) { if (foreground > 0) { this.Screen.SetForegroundColor(foreground); } if (background > 0) { this.Screen.SetBackgroundColor(background); } }
private ConsoleColor ZColorToConsoleColor(ZColor c, bool fore) { switch (c) { case ZColor.PixelUnderCursor: case ZColor.Current: return(fore ? Console.ForegroundColor : Console.BackgroundColor); case ZColor.Default: return(fore ? _defaultFore : _defaultBack); case ZColor.Black: return(ConsoleColor.Black); case ZColor.Red: return(ConsoleColor.Red); case ZColor.Green: return(ConsoleColor.Green); case ZColor.Yellow: return(ConsoleColor.Yellow); case ZColor.Blue: return(ConsoleColor.Blue); case ZColor.Magenta: return(ConsoleColor.Magenta); case ZColor.Cyan: return(ConsoleColor.Cyan); case ZColor.White: return(ConsoleColor.White); case ZColor.DarkishGrey: return(ConsoleColor.DarkGray); case ZColor.LightGrey: return(ConsoleColor.Gray); case ZColor.MediumGrey: return(ConsoleColor.Gray); case ZColor.DarkGrey: return(ConsoleColor.DarkGray); } return(Console.ForegroundColor); }
public Task SetBackgroundColorAsync(ZColor color) { return(foregroundThreadAffinitedObject.InvokeBelowInputPriority(() => this.fontAndColorService.SetBackgroundColor(color))); }
public override string ToString() { return($" T=[{TColor.ToString()}]\n J=[{JColor.ToString()}]\n Z=[{ZColor.ToString()}]\n O=[{OColor.ToString()}]\n S=[{SColor.ToString()}]\n L=[{LColor.ToString()}]\n I=[{IColor.ToString()}]"); }
public void SetBackgroundColor(ZColor background) { this.backgroundBrush = background == ZColor.Default ? this.defaultBackgroundBrush : GetZColorBrush(background); }
public void SetColor(ZColor foreground, ZColor background) { Console.ForegroundColor = ZColorToConsoleColor(foreground, true); Console.BackgroundColor = ZColorToConsoleColor(background, false); }
public void SetForegroundColor(ZColor foreground) { this.foregroundBrush = foreground == ZColor.Default ? this.defaultForegroundBrush : GetZColorBrush(foreground); }
public void SetForegroundColor(ZColor color) { }
public void SetBackgroundColor(ZColor color) { }
public void SetColor(ZColor foreground, ZColor background) { }
public void SetColor(ZColor foreground, ZColor background) { throw new System.NotImplementedException(); }
public static Color Color(ZColor color) { return(new Color(color.R, color.G, color.B, color.A)); }