withLightness method

RayOklab withLightness(
  1. double lightness
)

Creates a new RayOklab with a different lightness value.

lightness must be between 0.0 (black) and 1.0 (white). The opponent color components (a, b) and opacity remain unchanged.

Implementation

RayOklab withLightness(double lightness) {
  if (lightness < 0.0 || lightness > 1.0) {
    throw ArgumentError.value(
        lightness, 'lightness', 'Lightness must be between 0.0 and 1.0');
  }
  return RayOklab._(l: lightness, a: _a, b: _b, opacity: opacity);
}