/// <summary> /// Writes a tokenized string, each chunk with its color specification /// </summary> /// <param name="token">chunks of the string</param> public IConsole WriteLine(ColorToken token) { lock (_innerWriteLock) { Color prevColor = new Color(SysConsole.ForegroundColor, SysConsole.BackgroundColor); SysConsole.ForegroundColor = token.Color.Foreground; SysConsole.BackgroundColor = token.Color.Background; SysConsole.WriteLine(token.Text); SysConsole.ForegroundColor = prevColor.Foreground; SysConsole.BackgroundColor = prevColor.Background; } if (addToBuffer) { questionBuffer.Add(new ColorTokenItem(token, true)); } return(this); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to DarkGray</summary> public static ColorToken OnDarkGray(this ColorToken token) { return(token.On(ConsoleColor.DarkGray)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to DarkBlue</summary> public static ColorToken OnDarkBlue(this ColorToken token) { return(token.On(ConsoleColor.DarkBlue)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to Cyan</summary> public static ColorToken OnCyan(this ColorToken token) { return(token.On(ConsoleColor.Cyan)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to Yellow</summary> public static ColorToken Yellow(this ColorToken token) { return(token.Color(ConsoleColor.Yellow)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to White</summary> public static ColorToken White(this ColorToken token) { return(token.Color(ConsoleColor.White)); }
/// <summary> /// Writes a tokenized string /// </summary> /// <param name="token">chunks of the string</param> public IConsole Write(ColorToken token) { return(Write(token.Text, token.Color)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to Magenta</summary> public static ColorToken OnMagenta(this ColorToken token) { return(token.On(ConsoleColor.Magenta)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to DarkMagenta</summary> public static ColorToken DarkMagenta(this ColorToken token) { return(token.Color(ConsoleColor.DarkMagenta)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to Black</summary> public static ColorToken OnBlack(this ColorToken token) { return(token.On(ConsoleColor.Black)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to Blue</summary> public static ColorToken Blue(this ColorToken token) { return(token.Color(ConsoleColor.Blue)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to <paramref name="color"/></summary> public static ColorToken Color(this ColorToken token, ConsoleColor color) { return(new ColorToken(token.Text, color, token.Color.Background)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to <paramref name="backColor"/></summary> public static ColorToken On(this ColorToken token, ConsoleColor backColor) { return(new ColorToken(token.Text, token.Color.Foreground, backColor)); }
public ColorTokenItem(ColorToken token, bool newLine) : base(token.Text, token.Color) { NewLine = newLine; }
public ColorTokenItem(ColorToken token) : base(token.Text, token.Color) { }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to DarkYellow</summary> public static ColorToken OnDarkYellow(this ColorToken token) { return(token.On(ConsoleColor.DarkYellow)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to Green</summary> public static ColorToken OnGreen(this ColorToken token) { return(token.On(ConsoleColor.Green)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to DarkRed</summary> public static ColorToken DarkRed(this ColorToken token) { return(token.Color(ConsoleColor.DarkRed)); }
/// <summary>Returns a <see cref="ColorToken"/> with background color set to Red</summary> public static ColorToken OnRed(this ColorToken token) { return(token.On(ConsoleColor.Red)); }
/// <summary>Returns a <see cref="ColorToken"/> with foreground color set to Gray</summary> public static ColorToken Gray(this ColorToken token) { return(token.Color(ConsoleColor.Gray)); }