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

Function hue

render/shade.go:183–197  ·  view source on GitHub ↗
(p, q, h float)

Source from the content-addressed store, hash-verified

181func C4(R, G, B, A float) Color { return Color{R, G, B, A} }
182
183func hue(p, q, h float) float {
184 if h < 0.0 {
185 h += 1.0
186 } else if h > 1.0 {
187 h -= 1.0
188 }
189 if h < 1.0/6.0 {
190 return p + (q-p)*6.0*h
191 } else if h < 1.0/2.0 {
192 return q
193 } else if h < 2.0/3.0 {
194 return p + (q-p)*6.0*(2.0/3.0-h)
195 }
196 return p
197}
198
199func HSL(H, S, L float) Color {
200 S, L = clamp1(S), clamp1(L)

Callers 1

HSLFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected