using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TrueCraft.API { /// /// Provides constants and functions for working with chat colors. /// public static class ChatColor { /// /// The color code for black. /// public const string Black = "§0"; /// /// The color code for dark blue. /// public const string DarkBlue = "§1"; /// /// The color code for dark green. /// public const string DarkGreen = "§2"; /// /// The color code for dark cyan. /// public const string DarkCyan = "§3"; /// /// The color code for dark red. /// public const string DarkRed = "§4"; /// /// The color code for dark purple. /// public const string Purple = "§5"; /// /// The color code for dark orange. /// public const string Orange = "§6"; /// /// The color code for gray. /// public const string Gray = "§7"; /// /// The color code for dark gray. /// public const string DarkGray = "§8"; /// /// The color code for blue. /// public const string Blue = "§9"; /// /// The color code for bright green. /// public const string BrightGreen = "§a"; /// /// The color code for cyan. /// public const string Cyan = "§b"; /// /// The color code for red. /// public const string Red = "§c"; /// /// The color code for pink. /// public const string Pink = "§d"; /// /// The color code for yellow. /// public const string Yellow = "§e"; /// /// The color code for white. /// public const string White = "§f"; /// /// Removes the color codes from the specified string. /// /// The string to remove color codes from. /// public static string RemoveColors(string text) { var sb = new StringBuilder(text.Length); for (int i = 0; i < text.Length; i++) { if (text[i] == '§') { i++; continue; } sb.Append(text[i]); } return sb.ToString(); } } }