Esempio n. 1
0
 /// <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);
 }
Esempio n. 2
0
 /// <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));
 }
Esempio n. 3
0
 /// <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));
 }
Esempio n. 4
0
 /// <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));
 }
Esempio n. 5
0
 /// <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));
 }
Esempio n. 6
0
 /// <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));
 }
Esempio n. 7
0
 /// <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));
 }
Esempio n. 8
0
 /// <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));
 }
Esempio n. 9
0
 /// <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));
 }
Esempio n. 10
0
 /// <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));
 }
Esempio n. 11
0
 /// <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));
 }
Esempio n. 12
0
 /// <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));
 }
Esempio n. 13
0
 /// <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));
 }
Esempio n. 14
0
 public ColorTokenItem(ColorToken token, bool newLine) : base(token.Text, token.Color)
 {
     NewLine = newLine;
 }
Esempio n. 15
0
 public ColorTokenItem(ColorToken token) : base(token.Text, token.Color)
 {
 }
Esempio n. 16
0
 /// <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));
 }
Esempio n. 17
0
 /// <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));
 }
Esempio n. 18
0
 /// <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));
 }
Esempio n. 19
0
 /// <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));
 }
Esempio n. 20
0
 /// <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));
 }