Beispiel #1
0
 /// <summary>
 /// Creates a <see cref="ColoredString"/> object from an existing string with the specified foreground, background, and cell effect.
 /// </summary>
 /// <param name="value">The current string.</param>
 /// <param name="foreground">The foreground color.</param>
 /// <param name="background">The background color.</param>
 /// <param name="effect">The cell effect.</param>
 /// <returns>A <see cref="ColoredString"/> object instace.</returns>
 public static ColoredString CreateColored(this string value, Color foreground, Color background, ICellEffect effect)
 {
     ColoredString newString = new ColoredString(value);
     newString.Foreground = foreground;
     newString.Background = background;
     newString.Effect = effect;
     newString.UpdateWithDefaults();
     return newString;
 }
Beispiel #2
0
 /// <summary>
 /// Creates a <see cref="ColoredString"/> object from an existing string with the specified foreground and background.
 /// </summary>
 /// <param name="value">The current string.</param>
 /// <param name="appearance">The foreground and background color.</param>
 /// <returns>A <see cref="ColoredString"/> object instace.</returns>
 public static ColoredString CreateColored(this string value, ICellAppearance appearance)
 {
     ColoredString newString = new ColoredString(value);
     newString.Foreground = appearance.Foreground;
     newString.Background = appearance.Background;
     newString.Effect = null;
     newString.UpdateWithDefaults();
     return newString;
 }