copyWith method

  1. @override
OklabColor copyWith({
  1. num? lightness,
  2. num? a,
  3. num? b,
  4. int? alpha,
})

Returns a copy of this color modified with the provided values.

Implementation

@override
OklabColor copyWith({num? lightness, num? a, num? b, int? alpha}) {
  assert(lightness == null || (lightness >= 0.0 && lightness <= 1.0));
  assert(a == null || (a >= 0.0 && a <= 1.0));
  assert(b == null || (b >= 0.0 && b <= 1.0));
  assert(alpha == null || (alpha >= 0 && alpha <= 255));
  return OklabColor(
    lightness?.toDouble() ?? this.lightness,
    a?.toDouble() ?? this.a,
    b?.toDouble() ?? this.b,
    alpha ?? this.alpha,
  );
}