Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color codes for discord.py

I found it a bit difficult and annoying to change colors in discord.py (embed color for instance). I made a class for the different color codes to use in discord.py which can be imported into the main file.

class colors:
    default = 0
    teal = 0x1abc9c
    dark_teal = 0x11806a
    green = 0x2ecc71
    dark_green = 0x1f8b4c
    blue = 0x3498db
    dark_blue = 0x206694
    purple = 0x9b59b6
    dark_purple = 0x71368a
    magenta = 0xe91e63
    dark_magenta = 0xad1457
    gold = 0xf1c40f
    dark_gold = 0xc27c0e
    orange = 0xe67e22
    dark_orange = 0xa84300
    red = 0xe74c3c
    dark_red = 0x992d22
    lighter_grey = 0x95a5a6
    dark_grey = 0x607d8b
    light_grey = 0x979c9f
    darker_grey = 0x546e7a
    blurple = 0x7289da
    greyple = 0x99aab5

It is possible to use e.g. colors.red if red color is wanted. Is there any better way to do this?

like image 858
Remi_Zacharias Avatar asked Sep 06 '20 19:09

Remi_Zacharias


People also ask

Is discord PY getting discontinued?

Discord py is getting discontinued because Discord implemented more and more restrictions for Bot Developers, promised easy verification steps but is behind verification processes by months. Yet introducing more restrictions and now requiring even ID copies.

What color is white in HTML?

#FFFFFF means full FF amounts of Red, Green, and Blue. The result is WHITE. #FFEFD5 has high values for all colors, giving a light result: PAPAYAWHIP.


2 Answers

You could also use RGB codes by doing

embed=discord.Embed(COLOR=discord.Color.from_rgb(RGB code)
like image 145
twg poseidon Avatar answered Sep 30 '22 16:09

twg poseidon


You already have the discord.Colour class (or discord.Color) for this:

from discord import Color

teal = Color.teal()

You can even change Color to everything you want like so:

from discord import Color as c

teal = c.teal()

You can look at discord.py documentation for more informations.

like image 30
MrSpaar Avatar answered Sep 30 '22 18:09

MrSpaar