relativeTemperature method
- 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) {
final range = tempsByHct[warmest]! - tempsByHct[coldest]!;
final differenceFromColdest = tempsByHct[hct]! - tempsByHct[coldest]!;
// Handle when there's no difference in temperature between warmest and
// coldest: for example, at T100, only one color is available, white.
if (range == 0.0) {
return 0.5;
}
return differenceFromColdest / range;
}