tone property Null safety

double tone

Lightness. Ranges from 0 to 100.

Implementation

double get tone {
  return _tone;
}
void tone=(double newTone)

0 <= newTone <= 100; invalid values are corrected. After setting tone, 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 tone(double newTone) {
  _argb = CamSolver.solveToInt(hue, chroma, newTone);
  final cam16 = Cam16.fromInt(_argb);
  _hue = cam16.hue;
  _chroma = cam16.chroma;
  _tone = ColorUtils.lstarFromArgb(_argb);
}