1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-28 21:29:25 +00:00

Discord: Added a convenient RGB function for Color

This commit is contained in:
diamondburned (Forefront) 2020-02-23 10:11:10 -08:00
parent 4a1d6ad456
commit 55ebeaf45f

View file

@ -14,6 +14,19 @@ func (c Color) Int() int {
return int(c)
}
// RGB splits Color into red, green, and blue. The maximum value is 255.
func (c Color) RGB() (uint8, uint8, uint8) {
var (
color = c.Uint32()
r = uint8((color >> 16) & 255)
g = uint8((color >> 8) & 255)
b = uint8(color & 255)
)
return r, g, b
}
type Embed struct {
Title string `json:"title,omitempty"`
Type EmbedType `json:"type,omitempty"`