toLabColor method
Implementation
LabColor toLabColor() {
// To xyz color
num xyzR = _toXyz(r / 255);
num xyzG = _toXyz(g / 255);
num xyzB = _toXyz(b / 255);
num x = xyzR * 0.4124 + xyzG * 0.3576 + xyzB * 0.1805;
num y = xyzR * 0.2126 + xyzG * 0.7152 + xyzB * 0.0722;
num z = xyzR * 0.0193 + xyzG * 0.1192 + xyzB * 0.9505;
// To lab color
num labX = _toLab(x, 95.047);
num labY = _toLab(y, 100);
num labZ = _toLab(z, 108.883);
num labL = (116 * labY) - 16;
num labA = 500 * (labX - labY);
num labB = 200 * (labY - labZ);
return LabColor(labL, labA, labB);
}