hue property Null safety

double hue

A number, in degrees, representing ex. red, orange, yellow, etc. Ranges from 0 <= hue < 360

Implementation

double get hue {
  return _hue;
}
void hue=(double newHue)

0 <= newHue < 360; invalid values are corrected. After setting hue, the color is mapped from HCT to the more limited sRGB gamut for display. This will change its ARGB/integer representation. If the HCT color is outside of the sRGB gamut, chroma will decrease until it is inside the gamut.

Implementation

set hue(double newHue) {
  _argb = CamSolver.solveToInt(newHue, chroma, tone);
  final cam16 = Cam16.fromInt(_argb);
  _hue = cam16.hue;
  _chroma = cam16.chroma;
  _tone = ColorUtils.lstarFromArgb(_argb);
}