You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you please teach me how to include colour in IRC messages?
4
+
5
+
# Answer
6
+
7
+
8
+
9
+
Including color in IRC messages involves using special control codes that are recognized by most IRC clients. These control codes allow you to format your messages with different colors or styles like bold or underline. Here's how you can do it:
10
+
11
+
### 1. **Color Control Code**
12
+
- The control code for color is **`Ctrl + K`**, which appears as `\x03` in raw text.
13
+
- After the color code, you specify the foreground color number, optionally followed by a comma and the background color number.
14
+
15
+
### 2. **Color Codes**
16
+
Here are the standard IRC color codes:
17
+
18
+
| Code | Color | Code | Color |
19
+
|------|----------------|------|----------------|
20
+
| 00 | White | 08 | Yellow |
21
+
| 01 | Black | 09 | Light Green |
22
+
| 02 | Blue (Navy) | 10 | Cyan |
23
+
| 03 | Green | 11 | Light Cyan |
24
+
| 04 | Red | 12 | Light Blue |
25
+
| 05 | Brown (Maroon) | 13 | Pink |
26
+
| 06 | Purple | 14 | Grey |
27
+
| 07 | Orange | 15 | Light Grey |
28
+
29
+
### 3. **Example Usage**
30
+
To include color in your messages, use the format:
31
+
32
+
```
33
+
\x03<foreground>,<background>Text
34
+
```
35
+
36
+
#### Examples:
37
+
1.**Simple colored text** (e.g., Red text):
38
+
```
39
+
\x034This text is red.
40
+
```
41
+
Output: *This text is red.*
42
+
43
+
2.**Text with a background color** (e.g., Green text on a Yellow background):
44
+
```
45
+
\x033,08This text is green with a yellow background.
46
+
```
47
+
Output: *This text is green with a yellow background.*
48
+
49
+
3.**Resetting the color**:
50
+
To stop the color effect, you can use the reset code: **`Ctrl + O`** (`\x0F` in raw text).
| Reverse Color | \x16 | Swaps foreground and background. |
67
+
68
+
#### Example with Bold and Color:
69
+
```
70
+
\x02\x034Bold and Red\x0F Normal text
71
+
```
72
+
Output: **Bold and Red***Normal text.*
73
+
74
+
### 5. **Send Messages**
75
+
When typing in an IRC client:
76
+
- Use `Ctrl + K` to insert the color code.
77
+
- Follow with the numeric codes for foreground and background colors as needed.
78
+
79
+
If you're scripting for an IRC bot or using raw IRC commands, include the control characters as their ASCII values (`\x03`, `\x02`, etc.) directly in your message string.
80
+
81
+
Let me know if you’d like examples in a specific programming language, like Go or PHP, for sending these formatted IRC messages!
0 commit comments