LabColor.extrapolate constructor

LabColor.extrapolate(
  1. List<double> values
)

Constructs a LabColor from a list of lab values on a 0 to 1 scale.

lab must not be null and must have exactly 3 or 4 values.

Each of the values must be >= 0 and <= 1.

Implementation

factory LabColor.extrapolate(List<double> values) {
  assert(values.length == 3 || values.length == 4);
  assert(values[0] >= 0 && values[0] <= 1);
  assert(values[1] >= 0 && values[1] <= 1);
  assert(values[2] >= 0 && values[2] <= 1);
  if (values.length == 4) assert(values[3] >= 0 && values[3] <= 1);
  final alpha = values.length == 4 ? (values[3] * 255).round() : 255;
  return LabColor(values[0] * 100, (values[1] * 255) - 128,
      (values[2] * 255) - 128, alpha);
}