如何将嵌入消息颜色更改为白色? [复制]

Posted

技术标签:

【中文标题】如何将嵌入消息颜色更改为白色? [复制]【英文标题】:How to change embed message colour to white? [duplicate] 【发布时间】:2021-08-22 23:33:13 【问题描述】:

在 python 中编写一个不和谐的机器人也是如此,我想将嵌入消息的颜色更改为白色。

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

我尝试使用:

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

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

如何将颜色改为白色?

【问题讨论】:

【参考方案1】:

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

颜色 = 0xeeffee

有了这个,我能够生产:

使用以下代码:

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)

【讨论】:

【参考方案2】:

我建议使用十六进制代码而不是 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)

【讨论】:

以上是关于如何将嵌入消息颜色更改为白色? [复制]的主要内容,如果未能解决你的问题,请参考以下文章

是否可以将状态栏文本(前景)颜色更改为任意颜色(即不是黑色或白色)? [复制]

如何将 Bootstrap 3 的字形图标更改为白色? [复制]

如何将 UILabel 文本颜色与其背景匹配? [复制]

点击时如何更改 UIButton 的标题颜色? [复制]

material-ui 组件样式自定义 - 将选择组件的颜色更改为白色

如何更改选项菜单点的颜色? [复制]