ratioOfTones static method

double ratioOfTones(
  1. double toneA,
  2. double toneB
)

Returns a contrast ratio, which ranges from 1 to 21. toneA Tone between 0 and 100. Values outside will be clamped. toneB Tone between 0 and 100. Values outside will be clamped.

Implementation

static double ratioOfTones(double toneA, double toneB) {
  toneA = MathUtils.clampDouble(0.0, 100.0, toneA);
  toneB = MathUtils.clampDouble(0.0, 100.0, toneB);
  return _ratioOfYs(
      ColorUtils.yFromLstar(toneA), ColorUtils.yFromLstar(toneB));
}