Discord Colored Text Generator: Every Color & How to Use It
Discord doesn't have a color picker. There's no [color=red] tag, no font dropdown, no way to highlight a single word in blue from the message box.
But every server you've seen with red warnings, green success messages, and cyan announcements is using one of two tricks: syntax-highlighted code blocks or ANSI color codes. Both are built into Discord's markdown — they're just hidden behind some unintuitive syntax.
This guide covers every color you can produce, the exact syntax for each one, and the gotchas that make your formatting break in DMs or on mobile.
Test colors before you paste them. Use the Discord Message Editor to write your code block and see the exact color rendering live, the same way Discord will show it.
Why Discord has "colors" at all
Discord uses a JavaScript library called highlight.js to syntax-highlight code blocks in chat. When you wrap text in triple backticks and add a language hint like diff, bash, or yaml, Discord runs your text through that language's rules and colors keywords, strings, and operators accordingly.
That means the colors aren't a feature — they're a side effect. By writing text that looks like specific syntax, you can force whatever color you want.
There's a second method using ANSI escape codes inside a code block tagged ansi, which gives you direct color control without needing to disguise your words as syntax. ANSI is more flexible but doesn't render reliably on every Discord client. We'll cover both.
Method 1: The code block trick (works everywhere)
This is the safer of the two methods. It uses standard syntax highlighting, which has worked the same way for years and renders identically on desktop, web, and mobile.
The structure is always the same:
```languagehint
your text here
The `languagehint` controls which highlighting rules Discord applies. Below is the full color cheat sheet.
### Red text
```diff
- This is red text
- Use the "diff" language and prefix lines with a minus sign
Green text
+ This is green text
+ Same diff block, but prefix with a plus sign
Cyan text
"This is cyan text"
'Single quotes also work'
The bash language colors quoted strings in cyan. Anything outside quotes stays the default color.
Blue text
keyname: this comes out blue
In yaml, the part before the colon renders blue. The value after the colon stays default.
Light blue / pale blue
.classname {
blue text inside braces
}
CSS coloring picks up class names and selectors as light blue.
Yellow / orange text
This entire block is yellow/orange
Every line in a "fix" block uses the warning color
The fix language highlights everything in a single warm color. Best when the whole message is the warning.
Purple text
[purple text inside brackets]
INI uses purple for section headers in square brackets.
Strong red (highlighted)
@@ This appears with stronger red emphasis @@
The @@ syntax in diff is for "hunk headers" and renders with extra emphasis.
Method 2: ANSI color codes (more colors, less reliable)
ANSI codes are escape sequences that browsers and terminals use for colors. Discord supports them inside an ansi code block. You get more colors and bolder formatting, but it doesn't render correctly in every Discord client (older mobile builds and some embeds strip the codes).
The format is \u001b[<code>m followed by your text, then \u001b[0m to reset.
When typing manually, you don't actually type \u001b — you need the literal escape character (ESC, character code 27). The easiest way is to copy a working block:
[0;31mRed text[0;0m
[0;32mGreen text[0;0m
[0;33mYellow text[0;0m
[0;34mBlue text[0;0m
[0;35mPink text[0;0m
[0;36mCyan text[0;0m
[0;37mWhite text[0;0m
(In the actual code block you'd have an invisible escape character before each [.)
ANSI foreground color codes
| Code | Color | |---|---| | 30 | Gray | | 31 | Red | | 32 | Green | | 33 | Yellow | | 34 | Blue | | 35 | Pink | | 36 | Cyan | | 37 | White |
ANSI background color codes
| Code | Background | |---|---| | 40 | Dark blue | | 41 | Orange | | 42 | Marble blue | | 43 | Gray-turquoise | | 44 | Gray | | 45 | Indigo | | 46 | Light gray | | 47 | White |
ANSI style modifiers
You can prepend a style code, separated by a semicolon: \u001b[1;31m makes bold red text.
| Code | Effect | |---|---| | 0 | Reset / default | | 1 | Bold | | 4 | Underline |
Combine codes by separating them with semicolons: \u001b[1;4;33m is bold underlined yellow.
The message editor renders ANSI blocks live so you can verify before sending — copying the wrong escape character is the #1 reason ANSI blocks fail.
Picking the right method
Quick rules:
- Want red error text? Use
diffwith a-prefix. Universal, always works. - Want green success text? Use
diffwith a+prefix. - Want a one-color warning block? Use
fix. - Need more than 4 colors in one message? Use
ansi, but accept that mobile users may see plain text. - Mixing colors in a single line? Use
ansi. Code blocks can only color one piece per block.
Real-world examples
Server announcement
+ NEW: Friday game nights at 8pm EST
- REMOVED: #old-events channel
! UPDATE: Bot prefix changed to /
The ! prefix in diff blocks renders as orange, giving you three colors in a single block.
Status indicator
WARNING: Maintenance window in 30 minutes
A single warm-colored line stands out without needing any prefix character.
Patch notes
+ Added: new emoji pack
+ Added: weekend events channel
- Removed: NSFW category (moved to alt server)
* Changed: role hierarchy reorganized
Standard changelog format, color-coded by action type.
Roleplay status
[Status: Wounded]
Purple section header for a quick character status indicator. Pairs well with roleplay formatting.
What breaks the colors
A short list of things that silently kill code-block coloring:
- Smart quotes. Copying from Google Docs replaces
"with"or". Highlight.js doesn't recognize them. Always paste through plain text first. - A space after the language hint.
```diff(with trailing space) sometimes works, sometimes doesn't. Keep it tight:```diffthen newline. - Mismatched backticks. Three backticks open, three to close. Two of either won't trigger the block.
- Markdown inside the block.
**bold**renders as literal asterisks inside a code block. That's expected — code blocks are literal. - Empty first line. Some clients treat a code block with only a language hint and no content as malformed. Always include at least one character of text.
Where to go next
- How to make text small, colored, or hidden in Discord — broader formatting overview
- Discord text tools complete toolkit — every tool you'd want next to this one
- Discord roleplay formatting guide — colors as character status, dialogue tags, and scene markers
- Discord 2000 character limit guide — for when your colored announcement gets too long
The fastest path to clean colored messages: write it in the message editor, preview it live, copy when it looks right. No surprises after you press send.