solveForContrast function

int solveForContrast(
  1. double l0,
  2. double c,
  3. double hDeg,
  4. int bgArgb,
  5. double target,
)

solveLightness that throws when the target is unreachable.

Implementation

int solveForContrast(
  double l0,
  double c,
  double hDeg,
  int bgArgb,
  double target,
) =>
    solveLightness(
      l0: l0,
      c: c,
      hDeg: hDeg,
      againstArgb: bgArgb,
      target: target,
    ) ??
    (throw StateError(
      'contrast $target unreachable against '
      '0x${bgArgb.toRadixString(16)}',
    ));