contrast function

RGBA contrast(
  1. RGBA color,
  2. num adj
)

Implementation

RGBA contrast(RGBA color, num adj) {
  adj *= 255;
  double factor = (259 * (adj + 255)) / (255 * (259 - adj));
  return new RGBA(
    red: clampPixel((factor * (color.red - 128) + 128).round()),
    green: clampPixel((factor * (color.green - 128) + 128).round()),
    blue: clampPixel((factor * (color.blue - 128) + 128).round()),
    alpha: color.alpha,
  );
}