inputRelativeTemperature property

double get inputRelativeTemperature

Relative temperature of the input color. See relativeTemperature.

Implementation

double get inputRelativeTemperature {
  if (_inputRelativeTemperature >= 0.0) {
    return _inputRelativeTemperature;
  }

  final coldestTemp = tempsByHct[coldest]!;

  final range = tempsByHct[warmest]! - coldestTemp;
  final differenceFromColdest = tempsByHct[input]! - coldestTemp;
  final inputRelativeTemp =
      (range == 0.0) ? 0.5 : differenceFromColdest / range;

  _inputRelativeTemperature = inputRelativeTemp;
  return _inputRelativeTemperature;
}