copyWith method

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

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

Implementation

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