From 4c1678b62c73362c818d9d57d82caa2645693948 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 18 Apr 2021 16:16:34 +0000 Subject: [PATCH] Add stringers to color structs --- color.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/color.go b/color.go index accb926..7f3d2c2 100644 --- a/color.go +++ b/color.go @@ -163,6 +163,10 @@ func (c RGBColor) ColorString() string { return fmt.Sprintf("rgb:%d,%d,%d", c.R, c.G, c.B) } +func (c RGBColor) String() string { + return c.ColorString() +} + func (c RGBColor) Hex() string { return fmt.Sprintf("#%x%x%x", c.R, c.G, c.B) } @@ -184,6 +188,10 @@ func (c HSBKColor) ColorString() string { return strings.Join(s, " ") } +func (c HSBKColor) String() string { + return c.ColorString() +} + func (c HSBKColor) MarshalText() ([]byte, error) { return []byte(c.ColorString()), nil } @@ -196,6 +204,10 @@ func (c NamedColor) ColorString() string { return string(c) } +func (c NamedColor) String() string { + return c.ColorString() +} + func (c *Client) ValidateColor(color Color) (Color, error) { var ( err error