withChroma method

  1. @override
OklabColor withChroma(
  1. double chroma
)
override

Converts this color to the Oklab color space, calculates and applies a new lightness value from the proivded chroma value, and converts it back to the original color space.

Implementation

@override
OklabColor withChroma(double chroma) {
  assert(chroma >= 0.0 && chroma <= 1.0);
  final lightness =
      chroma == 0 ? 0.0 : (1.028 * math.pow(chroma, 1 / 6.9)) - 0.028;
  return copyWith(lightness: lightness);
}