Discord Colored Text Generator
Type your message, select some words, pick a color, then copy. You get an ansi code block that Discord shows in color. Nothing is sent anywhere.
The box above shows roughly how Discord's dark theme colors look. Select text first, then click a swatch.
The escape character (shown here as ␛) is invisible. Use the Copy button, because copying from the box may lose it.
How colored text works in Discord
Discord has no color option for normal messages. The trick is a code block with the language set to ansi. Inside it, Discord reads ANSI escape codes, the same codes terminals use for color, and paints the text. A colored word looks like this before Discord renders it:
```ansi
␛[0;31mThis is red␛[0m and this is normal
```␛ stands for the escape character (Unicode U+001B). You cannot type it on a normal keyboard, which is why people use a generator like this one.
Color codes
Each code starts with ␛[, lists numbers separated by semicolons and ends with m. 0 resets, 1 is bold, 4 is underline.
| Text color | Code | Background | Code |
|---|---|---|---|
| Gray | 30 | Dark blue | 40 |
| Red | 31 | Orange | 41 |
| Green | 32 | Marble blue | 42 |
| Yellow | 33 | Grey turquoise | 43 |
| Blue | 34 | Gray | 44 |
| Pink | 35 | Indigo | 45 |
| Cyan | 36 | Light gray | 46 |
| White | 37 | Cream | 47 |
Discord picks the exact shades, which follow the Solarized palette. The swatches here are close approximations. This tool sticks to these 16 basic codes, the set people use in Discord.
Limits and gotchas
- Not documented by Discord. Discord's Markdown help article and developer docs do not mention
ansiblocks. It is widely used on Discord's desktop app, but because it is undocumented, support can differ between apps and could change. Send a test message first, especially if your readers are on mobile. - It is a code block. The text uses a monospace font and sits in a grey box. Bold, links, mentions, emoji shortcodes and spoilers do not work inside it.
- 2,000 characters. Escape codes count toward Discord's message length limit, so heavily colored text runs out faster than you expect.
- Background colors fill only the characters, not the whole line.
Other ways to get color in Discord
Before ansi blocks worked, people used syntax highlighting languages to get color by accident, for example ```diff with lines starting + (green) or - (red). That still works and is simpler when you only need red and green:
```diff
+ this line is green
- this line is red
```More Discord tools
- Discord Text Formatter: bold, underline, spoilers, headers, subtext and code blocks with a live preview.
- Discord Timestamp Generator: times that show in every reader's own timezone.
- Discord Markdown cheat sheet: every formatting option on one page.
- Text color in Markdown: what works on GitHub, Notion, Jira and others.