relativeTemperature method

double relativeTemperature(
  1. Hct hct
)

Temperature relative to all colors with the same chroma and tone. Value on a scale from 0 to 1.

Implementation

double relativeTemperature(Hct hct) {
  // Achromatic colors have no meaningful hue; match the previous behavior
  // of treating them as mid-temperature. Thresholds mirror the achromatic
  // short-circuit in the HCT solver.
  if (hct.chroma < 0.0001 || hct.tone < 0.0001 || hct.tone > 99.9999) {
    return 0.5;
  }
  final position = _cyclePosition(hct.hue);
  return position <= 1.0 ? 1.0 - position : position - 1.0;
}