A guide to ANSI on Discord
source link: https://gist.github.com/kkrypt0nn/a02506f3712ff2d1c8ca7c9e0aed7c06
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
A guide to ANSI on Discord · GitHub
Messages with colors:
Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.
To be able to send a colored text, you need to use the ansi
language for your code block and provide a prefix of this format before writing your text:
\u001b[{format};{color}m
The \u001b
is the unicode for ESCAPE/ESC, see http://www.unicode-symbol.com/u/001B.html. If you want to use it yourself without bots, then you need to copy paste the character from the website.
After you've written this, you can type and text you wish, and if you want to reset the color back to normal, then you need to use \u001b[0m
as prefix.
Here is the list of values you can use to replace {format}
:
- 0: Normal
- 1: Bold
- 4: Underline
Here is the list of values you can use to replace {color}
:
The following values will change the text color.
- 30: Gray
- 31: Red
- 32: Green
- 33: Yellow
- 34: Blue
- 35: Pink
- 36: Cyan
- 37: White
The following values will change the text background color.
- 40: Firefly dark blue
- 41: Orange
- 42: Marble blue
- 43: Greyish turquoise
- 44: Gray
- 45: Indigo
- 46: Light gray
- 47: White
Let's take an example, I want a bold green colored text with the very dark blue background.
I simply use \u001b[0;40m
(background color) and \u001b[1;32m
(text color) as prefix. Note that the order is important, first you give the background color and then the text color.
Alternatively you can also directly combine them into a single prefix like the following: \u001b[1;40;32m
and you can also use multiple values. Something like \u001b[1;40;4;32m
would underline the text, make it bold, make it green and have a dark blue background.
Raw message:
```ansi
\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
or
\u001b[1;40;32mThat's some cool formatted text right?
```
Result:
The way the colors look like on Discord is shown in the image below ^^
Note: If the change as not been brought to you yet, or other users, then you can use other code blocks in the meantime to get colored text. See this gist: https://gist.github.com/matthewzring/9f7bbfd102003963f9be7dbcf7d40e51
Recommend
-
150
This site can’t be reached The webpage at https://github.com/vurtun/nuklear might be temporarily down or it may have moved permanently to a new web address.
-
27
ANSI Common Lisp combines an introduction to Lisp programming, and a convenient, up-to-date reference manual for ANSI Common Lisp. Beginners will find that its careful explanations and interesting exampl...
-
14
ANSI BBSing on the Apple IIgs for "BBS Week" Accelerated IIgs running Spectrum under GS/OS for "BBS Week" at r/Retrobattlestations.
-
8
如何去除ANSI Escape Sequences 通过 ANSI Escape Code 可以让终端上的输出更加华丽醒目,但是另一方面又让在脚本中抓取内容变得困难。 本文通过分析ANSI Escape Code的结...
-
9
Terminal Control Sequences 终端控制转义序列 Author: Amatist Kurisu 最早由 一篇游玩性质的 gist 文章 利用 ANSI 转义序列 玩出不一样的 stdout, 引起了对 ANSI 转义序列
-
5
Index of /internetinfo/standards/ansi/X3T9Index of /internetinfo/standards/ansi/X3T9
-
5
libproxyprotocol An ANSI C library to parse and create PROXY protocol v1 and v2 headers with support for all TLVs
-
4
取代 ANSI 亮度标准,极米推出 CCB 投影仪亮度标准|ccb|ansi|流明_网易订阅 IT之家 8 月 18 日消息,据极米官方消息,极米正式推出电影色彩亮度标准 (Cinema...
-
3
Regular Colors Value Color \e[0;30m Black \e[0;31m Red \e[0;32m Green \e[0;33m...
-
4
Regular Colors Value Color \e[0;30m Black \e[0;31m Red \e[0;32m Green \e[0;33m...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK