srgbToLinear function

double srgbToLinear(
  1. int c
)

Approximate sRGB to linear conversion for a single channel 0..255 → 0.0..1.0.

Implementation

double srgbToLinear(int c) {
  final s = c / 255.0;
  return s <= 0.04045
      ? s / 12.92
      : math.pow((s + 0.055) / 1.055, 2.4).toDouble();
}