(o)
| 128040 | // https://observablehq.com/@mbostock/lab-and-rgb |
| 128041 | const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; |
| 128042 | function labConvert(o) { |
| 128043 | if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); |
| 128044 | if (o instanceof Hcl) return hcl2lab(o); |
| 128045 | if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); |
| 128046 | var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; |
| 128047 | if (r === g && g === b) x = z = y; |
| 128048 | else { |
| 128049 | x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); |
| 128050 | z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); |
| 128051 | } |
| 128052 | return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); |
| 128053 | } |
| 128054 | function gray(l, opacity) { |
| 128055 | return new Lab(l, 0, 0, opacity == null ? 1 : opacity); |
| 128056 | } |
no test coverage detected