darkerUnsafe static method

double darkerUnsafe({
  1. required double tone,
  2. required double ratio,
})

Returns a tone <= tone that ensures ratio. Return value is between 0 and 100. Returns 0 if ratio cannot be achieved with tone.

This method is unsafe because the returned value is guaranteed to be in bounds for tone, i.e. between 0 and 100. However, that value may not reach the ratio with tone. For example, there is no color darker than T0.

tone Tone return value must contrast with. Range is 0 to 100. Invalid values will result in 0 being returned. ratio Desired contrast ratio of return value and tone parameter. Range is 1 to 21, invalid values have undefined behavior.

Implementation

static double darkerUnsafe({required double tone, required double ratio}) {
  final darkerSafe = darker(tone: (tone), ratio: ratio);
  return (darkerSafe < 0.0) ? 0.0 : darkerSafe;
}