如何将嵌入消息颜色更改为白色?

时间:2021-06-05 00:24:19

标签: python colors discord discord.py

在 python 中编写 discord bot 也是如此,我想将嵌入消息的颜色更改为白色。

white = discord.Color.from_rgb(255,255,255)
embed = discord.Embed(title = ":8ball:8ball", description = random.choice(responses), colour = white)    

我尝试使用:

  • 颜色 = discord.Color.from_rgb(255,255,255)
  • 颜色 = 16777215

但是颜色是这样的深灰色:

enter image description here

如何将颜色更改为白色?

2 个答案:

答案 0 :(得分:0)

我在一些随机的 github 页面上找到了我的解决方案:

颜色 = 0xeeffee

有了这个,我能够生产:

enter image description here

使用以下代码:

white = 0xeeffee
@client.command(name = "eightball", description = "Asks the 8ball a question.", aliases = ["8ball","8b"])
async def eightball(ctx,*,question):
    responses = ("It is Certain.","It is decidedly so.","Without a doubt.","Yes definitely.","You may rely on it.","As I see it, yes.","Most likely.","Outlook good.","Yes.","Signs point to yes.","Reply hazy, try again.","Ask again later.","Better not tell you now.","Cannot predict now.","Concentrate and ask again.","Don't count on it.","My reply is no.","My sources say no.","Outlook not so good.","Very doubtful.")
    embed = discord.Embed(title = ":8ball:8ball", description = random.choice(responses), colour = white)    
    await ctx.send(embed = embed)

答案 1 :(得分:0)

我建议使用十六进制代码而不是 discord.Color,除非使用一种基色。您可以通过在此处拖动 (https://htmlcolorcodes.com/color-picker/) 来获得十六进制,然后只需复制给定的代码(例如 FFFFFF)并将 0x 附加到前面(因此它变为 0xFFFFFF),这应该使嵌入变为白色!这也适用于具有有效十六进制代码的任何颜色。您还可以使用 (https://www.rgbtohex.net/) 将 rgb 值转换为十六进制代码!

所以在这种情况下:

white = 0xFFFFFF
embed = discord.Embed(title = ":8ball:8ball", description = random.choice(responses), colour = white)