diff --git a/color.go b/color.go index 3ec3ac5..e6b045d 100644 --- a/color.go +++ b/color.go @@ -211,6 +211,11 @@ func (c Color) DecodeMsgpack(dec *msgpack.Decoder) error { // return nil // } +// IsZero returns if the color is all zeroes (invisible). +func (c Color) IsZero() bool { + return c.Red+c.Green+c.Blue+c.Alpha == 0 +} + // Add a relative color value to the color. func (c Color) Add(r, g, b, a int) Color { var ( @@ -237,6 +242,16 @@ func (c Color) Add(r, g, b, a int) Color { } } +// AddColor adds another Color to your Color. +func (c Color) AddColor(other Color) Color { + return c.Add( + int(other.Red), + int(other.Green), + int(other.Blue), + int(other.Alpha), + ) +} + // Lighten a color value. func (c Color) Lighten(v int) Color { return c.Add(v, v, v, 0)