/// <summary>Gets the ANSI sequence to set all of the attribute, forground, and background colors.</summary> /// <param name="attribute">Which attribute to set.</param> /// <param name="foregroundColor">Which foreground color to set.</param> /// <param name="backgroundColor">Which background color to set.</param> /// <returns>The ANSI sequence to set all of the attribute, forground, and background colors.</returns> public static string SetTextAttributes(AnsiAttribute attribute, AnsiForegroundColor foregroundColor, AnsiBackgroundColor backgroundColor) { return(Esc + string.Format( "[{0};{1};{2}m", (int)attribute, (int)foregroundColor, (int)backgroundColor)); }
public void Ctor_CharsetIsCorrect() { var target = new AnsiAttribute(); target.CharSet.Should().Be(CharSet.Ansi); }
/// <summary>Gets the ANSI sequence to set the text attribute.</summary> /// <param name="attribute">Which attribute to set.</param> /// <returns>The ANSI sequence to set the text attribute.</returns> public static string SetTextAttributes(AnsiAttribute attribute) { return(Esc + string.Format("[{0}m", (int)attribute)); }
/// <summary>Gets the ANSI sequence to set the text attribute.</summary> /// <param name="attribute">Which attribute to set.</param> /// <returns>The ANSI sequence to set the text attribute.</returns> public static string SetTextAttributes(AnsiAttribute attribute) { return($"{ESC}[{(int)attribute}m"); }
/// <summary>Gets the ANSI sequence to set all of the attribute, forground, and background colors.</summary> /// <param name="attribute">Which attribute to set.</param> /// <param name="foregroundColor">Which foreground color to set.</param> /// <param name="backgroundColor">Which background color to set.</param> /// <returns>The ANSI sequence to set all of the attribute, forground, and background colors.</returns> public static string SetTextAttributes(AnsiAttribute attribute, AnsiForegroundColor foregroundColor, AnsiBackgroundColor backgroundColor) { return($"{ESC}[{(int)attribute};{(int)foregroundColor};{(int)backgroundColor}m"); }
/// <summary>Gets the ANSI sequence to set the text attribute.</summary> /// <param name="attribute">Which attribute to set.</param> /// <returns>The ANSI sequence to set the text attribute.</returns> public static string SetTextAttributes(AnsiAttribute attribute) { return Esc + string.Format("[{0}m", (int)attribute); }
/// <summary>Gets the ANSI sequence to set all of the attribute, forground, and background colors.</summary> /// <param name="attribute">Which attribute to set.</param> /// <param name="foregroundColor">Which foreground color to set.</param> /// <param name="backgroundColor">Which background color to set.</param> /// <returns>The ANSI sequence to set all of the attribute, forground, and background colors.</returns> public static string SetTextAttributes(AnsiAttribute attribute, AnsiForegroundColor foregroundColor, AnsiBackgroundColor backgroundColor) { return Esc + string.Format( "[{0};{1};{2}m", (int)attribute, (int)foregroundColor, (int)backgroundColor); }