RayOklab.fromList constructor

RayOklab.fromList(
  1. List<num> values
)

Creates a RayOklab from a list of component values.

Accepts l, a, b or l, a, b, opacity in standard Oklab ranges.

Implementation

factory RayOklab.fromList(List<num> values) {
  if (values.length < 3 || values.length > 4) {
    throw ArgumentError(
        'Oklab color list must have 3 or 4 components (LABO)');
  }
  return RayOklab.fromComponents(
    values[0].toDouble(),
    values[1].toDouble(),
    values[2].toDouble(),
    values.length > 3 ? values[3].toDouble() : 1.0,
  );
}