How to Write in Color in Discord: The Complete ANSI Syntax Guide
Learn how to write colored text in Discord messages using ANSI escape sequences. Master all 8 colors, background highlights, bold formatting, and 1-click copy tricks.
Key Takeaways & Summary
- •Colored text requires wrapping your message in a triple-backtick codeblock declared with 'ansi'.
- •Colors are initiated using the escape character sequence '\u001b[CODEm' and cleared with '\u001b[0m'.
- •Discord supports 8 foreground text colors (Dark Gray, Red, Green, Yellow, Blue, Pink, Cyan, and White).
- •ANSI codeblocks render in color on Discord Desktop and Web clients; on some mobile app releases, they render in standard monospaced text.
- •Our Discord Colored Text Generator lets you type, highlight, and copy complete ANSI codeblocks with zero syntax errors.
Learn how ANSI escape codes inside codeblocks turn plain Discord chat into vibrant red, green, blue, yellow, and highlighted announcement banners.
For years, Discord users relied on clumsy syntax highlighting hacks (like using yaml or diff codeblocks) to simulate colors in chat. However, Discord introduced native support for ANSI terminal escape sequences inside codeblocks denoted with the 'ansi' syntax language tag. By leveraging ANSI escape codes, you can format individual words or entire paragraphs with 8 distinct text colors, 8 background highlight fills, bold typography, and underlined emphasis. In this guide, we break down the exact escape code syntax, provide copyable templates for moderation banners, and explain mobile compatibility.
The ANSI Escape Code Syntax Structure
ANSI terminal formatting relies on control sequences that instruct terminal emulators how to style text. To write colored text in Discord, you open a codeblock with ```ansi and write your message using this pattern:
\u001b[STYLE;COLORmYour Text Here\u001b[0m
Where: - \u001b: The unprintable Escape character (ASCII 27 / Hex 1B). - [: Opening bracket for the Control Sequence Introducer (CSI). - STYLE: 0 for normal, 1 for bold, 4 for underline. - COLOR: Two-digit numeric code specifying foreground or background color. - m: Terminating command letter. - \u001b[0m: Reset sequence that prevents colors from bleeding into subsequent text.
```ansi
[1;31m[CRITICAL][0m Server reboot in progress
[1;32m[SUCCESS][0m All services online
[1;33m[WARNING][0m High latency detected on EU node
[1;34m[INFO][0m Community game night starts tonight
```Complete Discord ANSI Color Code Reference Chart
Here are all supported color codes in Discord:
| Color | Foreground Code | Background Code | Best Practice Usage |
|---|---|---|---|
| Dark Gray | 30 | 40 | Timestamps, footers, subtle metadata |
| Red | 31 | 41 | Errors, urgent alerts, rule violations |
| Green | 32 | 42 | Success notices, bot online indicators |
| Yellow | 33 | 43 | Warnings, maintenance reminders |
| Blue | 34 | 44 | Information banners, hyperlinks, guides |
| Pink / Magenta | 35 | 45 | Events, giveaways, VIP role announcements |
| Cyan | 36 | 46 | Commands, channel names, role tags |
| Bright White | 37 | 47 | High-contrast headings and callouts |
Frequently Asked Questions
Straightforward answers to common questions about this topic.
This happens if you forgot to specify 'ansi' after the opening triple backticks, or if your text editor replaced the literal escape character with plain text. Use our visual editor to generate clean, verified escape tokens.
Generate Your Discord Timestamps Now
Convert any date or countdown into auto-adjusting Discord tags with 1-click copy.