copyWith method

  1. @override
HspColor copyWith({
  1. num? hue,
  2. num? saturation,
  3. num? perceivedBrightness,
  4. int? alpha,
})

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

Implementation

@override
HspColor copyWith({
  num? hue,
  num? saturation,
  num? perceivedBrightness,
  int? alpha,
}) {
  assert(hue == null || (hue >= 0 && hue <= 360));
  assert(saturation == null || (saturation >= 0 && saturation <= 100));
  assert(perceivedBrightness == null ||
      (perceivedBrightness >= 0 && perceivedBrightness <= 100));
  assert(alpha == null || (alpha >= 0 && alpha <= 255));
  return HspColor(
    hue ?? this.hue,
    saturation ?? this.saturation,
    perceivedBrightness ?? this.perceivedBrightness,
    alpha ?? this.alpha,
  );
}