This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 314
/
Copy pathChatColor.cs
113 lines (96 loc) · 2.91 KB
/
ChatColor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TrueCraft.API
{
/// <summary>
/// Provides constants and functions for working with chat colors.
/// </summary>
public static class ChatColor
{
/// <summary>
/// The color code for black.
/// </summary>
public const string Black = "§0";
/// <summary>
/// The color code for dark blue.
/// </summary>
public const string DarkBlue = "§1";
/// <summary>
/// The color code for dark green.
/// </summary>
public const string DarkGreen = "§2";
/// <summary>
/// The color code for dark cyan.
/// </summary>
public const string DarkCyan = "§3";
/// <summary>
/// The color code for dark red.
/// </summary>
public const string DarkRed = "§4";
/// <summary>
/// The color code for dark purple.
/// </summary>
public const string Purple = "§5";
/// <summary>
/// The color code for dark orange.
/// </summary>
public const string Orange = "§6";
/// <summary>
/// The color code for gray.
/// </summary>
public const string Gray = "§7";
/// <summary>
/// The color code for dark gray.
/// </summary>
public const string DarkGray = "§8";
/// <summary>
/// The color code for blue.
/// </summary>
public const string Blue = "§9";
/// <summary>
/// The color code for bright green.
/// </summary>
public const string BrightGreen = "§a";
/// <summary>
/// The color code for cyan.
/// </summary>
public const string Cyan = "§b";
/// <summary>
/// The color code for red.
/// </summary>
public const string Red = "§c";
/// <summary>
/// The color code for pink.
/// </summary>
public const string Pink = "§d";
/// <summary>
/// The color code for yellow.
/// </summary>
public const string Yellow = "§e";
/// <summary>
/// The color code for white.
/// </summary>
public const string White = "§f";
/// <summary>
/// Removes the color codes from the specified string.
/// </summary>
/// <param name="text">The string to remove color codes from.</param>
/// <returns></returns>
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();
}
}
}