From 0cc36ee51eccee0e6894624d2993a29614e5b807 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Thu, 31 Mar 2022 11:46:45 -0700 Subject: [PATCH] discord: Add Color.String --- discord/message_embed.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/message_embed.go b/discord/message_embed.go index a133e1d..b7ccddf 100644 --- a/discord/message_embed.go +++ b/discord/message_embed.go @@ -38,6 +38,12 @@ func (c Color) RGB() (uint8, uint8, uint8) { return r, g, b } +// String returns the Color in hexadecimal (#FFFFFF) format. +func (c Color) String() string { + r, g, b := c.RGB() + return fmt.Sprintf("#%02X%02X%02X", r, g, b) +} + func (c Color) MarshalJSON() ([]byte, error) { if c < 0 { return []byte("null"), nil