func TestMaybeColor(t *testing.T) { var m, c gohue.MaybeColor v := gohue.NewColor(0.4, 0.6) m.Set(v) if m != gohue.NewMaybeColor(v) { t.Error("MaybeColor Set broken.") } verifyString(t, "Just (0.4000, 0.6000)", m.String()) m.Clear() if m != c { t.Error("MaybeColor Clear broken.") } verifyString(t, "Nothing", m.String()) }
func maybeBlendColor(first, second gohue.MaybeColor, ratio float64) gohue.MaybeColor { if first.Valid && second.Valid { return gohue.NewMaybeColor(first.Blend(second.Color, ratio)) } return first }