public static StringBuilder Append(StringBuilder sb, ColoredText coloredText) { if (IsEnabled) { if (coloredText.ForegroundRgb != null) { sb.Append(Foreground(coloredText.ForegroundRgb)); } if (coloredText.BackgroundRgb != null) { sb.Append(Background(coloredText.BackgroundRgb)); } sb.Append(coloredText.Text); #if VT100_AUTO_RESET sb.Append(Reset); #endif } else { sb.Append(coloredText.Text); } return(sb); }
public static string GetString(ColoredText coloredText) => Append(new StringBuilder(), coloredText).ToString();