예제 #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
}