blackness property Null safety

num blackness

This color's blackness, a percentage between 0 and 100.


num get blackness {
  // Because HWB is (currently) used much less frequently than HSL or RGB, we
  // don't cache its values because we expect the memory overhead of doing so
  // to outweigh the cost of recalculating it on access.
  return 100 - math.max(math.max(red, green), blue) / 255 * 100;