mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-27 17:23:00 +00:00
discord: Add Color.String
This commit is contained in:
parent
eae129c928
commit
0cc36ee51e
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue