Eggdrop Colors and Formatting Guide
Eggdrop bots are one of the most popular IRC bots for managing channels, automating moderation, and sending messages. One of the most useful features of Eggdrop is the ability to send colorful and formatted messages using IRC color codes, bold, underline, and other text styles. By using proper Eggdrop color formatting in TCL scripts, you can make announcements, warnings, alerts, and log messages stand out in any IRC channel.
This guide explains everything from basic IRC color codes to advanced text formatting, along with an template that you can use directly in your Eggdrop scripts.
How IRC Color Codes Work in Eggdrop
IRC color codes are special control sequences that clients interpret to display colored text. In Eggdrop, these sequences are added in TCL scripts using the \003 control character, followed by a numeric code for the foreground color, optionally followed by a background color. Using color codes allows you to visually differentiate messages like alerts, notifications, and informational logs.
The standard syntax for colors in Eggdrop is:
\003<foreground>[,<background>]
foregroundis the main text color.backgroundis optional and specifies the text background.
Using this method, Eggdrop bots can send customized messages in any channel to improve readability and highlight important information.
Standard IRC Color Codes
The standard IRC color codes that work in Eggdrop are:
| Code | Color | Description |
|---|---|---|
| 0 | White | Default white text |
| 1 | Black | Usually not recommended for dark backgrounds |
| 2 | Blue | Dark blue color for text |
| 3 | Green | Green color for informational text |
| 4 | Red | Red color, often used for errors or alerts |
| 5 | Brown/Maroon | Earth tone, less common |
| 6 | Purple | Purple text for emphasis |
| 7 | Orange | Bold orange text for visibility |
| 8 | Yellow | Bright yellow, works well for warnings |
| 9 | Light Green | Lighter green for subtle highlights |
| 10 | Cyan | Cyan color, works for notifications |
| 11 | Light Cyan | Light cyan for secondary text |
| 12 | Light Blue | Light blue for headings or highlights |
| 13 | Pink/Magenta | Eye-catching pink/magenta text |
| 14 | Grey | Grey text for less important information |
| 15 | Light Grey | Light grey for subtle contrast |
Example usage in Eggdrop TCL:
putquick "PRIVMSG #channel :$msg"
In this example, \0034 sets the text color to red, and \017 resets formatting after the message to avoid affecting subsequent messages.
Text Formatting Codes in Eggdrop
In addition to colors, IRC supports bold, italic, underline, reverse, and reset codes. Eggdrop supports all of these codes in TCL scripts:
| Formatting | Control Code | Description |
|---|---|---|
| Bold | \002 |
Makes text bold for emphasis |
| Italic | \026 |
Italicizes text (may not be supported in all clients) |
| Underline | \037 |
Underlines text for highlighting |
| Reverse | \022 |
Swaps foreground and background colors |
| Reset | \017 |
Resets all formatting to default |
Bold and color codes can be combined to make text stand out:
putquick "PRIVMSG #channel :$msg"
This code will display “Bold Red Text” in red and bold, and then reset formatting afterward.
Combining Foreground and Background Colors
Eggdrop allows combining foreground and background colors in messages using the syntax \003<fg>,<bg>. This is useful for creating warning messages, alerts, or custom notifications.
Example: Yellow text on a blue background:
putquick "PRIVMSG #channel :$msg"
Foreground color code 8 represents yellow, and background code 2 represents blue. The reset code \017 ensures that subsequent text is not affected.
Best Practices for Eggdrop Color Formatting
When using colors and formatting in Eggdrop scripts, consider the following tips:
- Use putquick for sending messages to IRC channels, not putlog.
- Always reset formatting after colored messages to prevent leaking styles into other messages.
- Limit the number of colors per message to improve readability and compatibility with different IRC clients.
- Use helper functions for standard colors to maintain consistency across scripts.
- Test your formatting in multiple IRC clients, as some may interpret certain codes differently.
Themed Eggdrop Color Template
To make messages more consistent and visually appealing on SiSrv, we provide a pre-configured template for Eggdrop TCL scripts. This template includes bold red headers, green informational messages, yellow warnings, cyan highlights, and orange alerts. You can copy and use it directly in your scripts.
set msg ""
if {$bold} { append msg "\002" }
if {$bg eq ""} {
append msg "\003$fg"
} else {
append msg "\003$fg,$bg"
}
append msg $text "\017"
return $msg
}
proc header {text} {
return [colorize $text 4 "" 1] ;# Bold Red
}
proc info {text} {
return [colorize $text 3 "" 0] ;# Green
}
proc warning {text} {
return [colorize $text 8 "" 1] ;# Bold Yellow
}
proc highlight {text} {
return [colorize $text 10 "" 1] ;# Bold Cyan
}
proc alert {text} {
return [colorize $text 7 "" 1] ;# Bold Orange
}
proc announce {chan text} {
set hdr [header "SiSrv Announcement:"]
set body [info $text]
putquick "PRIVMSG $chan :$hdr $body"
}
proc warn {chan text} {
set msg [warning $text]
putquick "PRIVMSG $chan :$msg"
}
proc highlight_msg {chan text} {
set msg [highlight $text]
putquick "PRIVMSG $chan :$msg"
}
proc alert_msg {chan text} {
set msg [alert $text]
putquick "PRIVMSG $chan :$msg"
}
# Example usage:
# announce "#SiSrv" "Server maintenance starts in 10 minutes."
# warn "#SiSrv" "High lag detected on the server."
# highlight_msg "#SiSrv" "New feature available!"
# alert_msg "#SiSrv" "Ops: Please monitor users with multiple nicks."
Advanced Eggdrop Formatting Tips
- Define custom functions for different message types, like alerts or notifications.
- Use arrays or hashes to store frequently used color combinations for consistency.
- For multi-line messages, ensure that each line resets formatting to avoid leaks.
- Test your messages on multiple IRC clients like mIRC, HexChat, or KiwiIRC.
- Combine color and formatting codes sparingly to maintain readability and compatibility.
Summary
Using colors and formatting in Eggdrop TCL scripts is essential for professional-looking IRC messages. You can:
- Use
\003for colors with optional foreground and background. - Use
\002for bold,\037for underline,\022for reverse, and\017to reset. - Combine codes carefully for clear, readable output.
- Implement reusable templates like the color theme for consistent styling.
With this guide, Eggdrop admins and TCL scripters can enhance channel messages, alerts, and logs with visually appealing colors and formatting, making their IRC bot more effective and professional.
