toOklab method
Implementation
Oklab toOklab() {
final double l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
final double m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
final double s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
final double l2 = root(l, 3);
final double m2 = root(m, 3);
final double s2 = root(s, 3);
return Oklab(
0.2104542553 * l2 + 0.7936177850 * m2 - 0.0040720468 * s2,
1.9779984951 * l2 - 2.4285922050 * m2 + 0.4505937099 * s2,
0.0259040371 * l2 + 0.7827717662 * m2 - 0.8086757660 * s2,
);
}