MCPcopy Create free account
hub / github.com/tdewolff/canvas / OKLabGradient

Function OKLabGradient

palettes.go:161–170  ·  view source on GitHub ↗

OKLabGradient creates a gradient from (t,L,a,b) values with t∈[0,1] the position, L∈[0,1] the lightness, a∈[-1,1], and b∈[-1,1].

(points [][4]float64)

Source from the content-addressed store, hash-verified

159
160// OKLabGradient creates a gradient from (t,L,a,b) values with t∈[0,1] the position, L∈[0,1] the lightness, a∈[-1,1], and b∈[-1,1].
161func OKLabGradient(points [][4]float64) ColorFunc {
162 genSRGBLUTs()
163 if len(points) == 0 {
164 return func(y float64) color.RGBA { return color.RGBA{} }
165 }
166 return func(y float64) color.RGBA {
167 p := interpolateGradient(y, points)
168 return oklab2rgb(p[1], p[2], p[3])
169 }
170}

Callers 1

OKLCHGradientFunction · 0.85

Calls 2

interpolateGradientFunction · 0.85
oklab2rgbFunction · 0.85

Tested by

no test coverage detected