calculateRelativeLuminance static method

double calculateRelativeLuminance(
  1. int red,
  2. int green,
  3. int blue, {
  4. int decimals = 2,
})

Calculates the relative luminance for the given red, green, blue values.

The returned value is between 0 and 1 with the given decimals.

Implementation

static double calculateRelativeLuminance(int red, int green, int blue,
    {int decimals = 2}) {
  return MathUtils.round(
      (0.299 * red + 0.587 * green + 0.114 * blue) / 255, decimals);
}