示例#1
0
文件: hue_test.go 项目: keep94/gohue
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())
}
示例#2
0
文件: actions.go 项目: keep94/gohue
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
}