MCPcopy Create free account
hub / github.com/egonelbre/exp / hue

Function hue

pixel/cmc/color.go:35–51  ·  view source on GitHub ↗
(v1, v2, h float32)

Source from the content-addressed store, hash-verified

33}
34
35func hue(v1, v2, h float32) float32 {
36 if h < 0 {
37 h += 1
38 }
39 if h > 1 {
40 h -= 1
41 }
42 if 6*h < 1 {
43 return v1 + (v2-v1)*6*h
44 } else if 2*h < 1 {
45 return v2
46 } else if 3*h < 2 {
47 return v1 + (v2-v1)*(2.0/3.0-h)*6
48 }
49
50 return v1
51}
52
53func hsla(h, s, l, a float32) (r, g, b, ra float32) {
54 if s == 0 {

Callers 1

hslaFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected