Color codes for discord.py

25,303

Solution 1

You could also use RGB codes by doing

embed=discord.Embed(COLOR=discord.Color.from_rgb(RGB code)

Solution 2

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.

Solution 3

If you want to make custom colors you can do that as well. It would be as simple as getting them from RGB or HEX Color codes. Getting them from RGB would be:

import discord
beige = discord.Color.from_rgb(225, 198, 153)

and then for HEX color codes, it would be even simpler (not even needing to import discord) and just:

dark_red = 0x992d22

as you have above. Although you may want to not spend the time searching up the RGB/HEX color codes so discord has a built-in color system. The way you'd use that is by:

import discord
blue = discord.Color.blue()

read more about the color documentation here:

Share:
25,303
Remi_Zacharias
Author by

Remi_Zacharias

Updated on November 09, 2021

Comments

  • Remi_Zacharias
    Remi_Zacharias over 2 years

    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?

  • Remi_Zacharias
    Remi_Zacharias over 3 years
    thanks, thats were i found the color codes from but the reason i made my own class was because the discord.colour wasnt working for me