OklabColor.fromList constructor
Constructs an OklabColor from a list of lab
values.
lab
must have exactly 3
or 4
values.
The alpha value, if provided, must be >= 0 && <= 255
.
Implementation
factory OklabColor.fromList(List<double> values) {
assert(values.length == 3 || values.length == 4);
if (values.length == 4) assert(values[3] >= 0 && values[3] <= 255);
final alpha = values.length == 4 ? values[3].round() : 255;
return OklabColor(values[0], values[1], values[2], alpha);
}