Color text in discord

nonerth picture nonerth · Jan 18, 2017 · Viewed 112.9k times · Source

My goal is to partly color a text. I know I can use .sendCode("css","this is my message"); which we'll make my text yellow but I don't want my whole text to be yellow.

Perhaps I could create another .css file and then call it from my JavaScript file but as I am inexperienced with JavaScript I would like some help with it. I think that's the fastest way to do it.

Answer

Fabricio20 picture Fabricio20 · Feb 2, 2017

Discord doesn't allow colored text. Though, currently, you have two options to "mimic" colored text.

Option #1 (Markdown code-blocks)

Discord supports Markdown and uses highlight.js to highlight code-blocks. Some programming languages have specific color outputs from highlight.js and can be used to mimic colored output.

To use code-blocks, send a normal message in this format (Which follows Markdown's standard format).

```language
message
```

Languages that currently reproduce nice colors: prolog (red/orange), css (yellow).

Option #2 (Embeds)

Discord now supports Embeds and Webhooks, which can be used to display colored blocks, they also support markdown. For documentation on how to use Embeds, please read your lib's documentation.

(Embed Cheat-sheet)
Embed Cheat-sheet