lighterUnsafe static method

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

Returns a tone >= tone that ensures ratio. Return value is between 0 and 100. Returns 100 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 lighter than T100.

tone Tone return value must contrast with. Range is 0 to 100. Invalid values will result in 100 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 lighterUnsafe({required double tone, required double ratio}) {
  final lighterSafe = lighter(tone: (tone), ratio: ratio);
  return (lighterSafe < 0.0) ? 100.0 : lighterSafe;
}