colorSpace property

ColorSpace get colorSpace

The color space that is used by the Image's colors.

This value is a consequence of how the Image has been created. For example, loading a PNG that is in the Display P3 color space will result in a ColorSpace.extendedSRGB image.

On rendering backends that don't support wide gamut colors (anything but iOS impeller), wide gamut images will still report ColorSpace.sRGB if rendering wide gamut colors isn't supported.

Implementation

// Note: The docstring will become outdated as new platforms support wide
// gamut color, please keep it up to date.
ColorSpace get colorSpace {
  final int colorSpaceValue = _image.colorSpace;
  switch (colorSpaceValue) {
    case 0:
      return ColorSpace.sRGB;
    case 1:
      return ColorSpace.extendedSRGB;
    default:
      throw UnsupportedError('Unrecognized color space: $colorSpaceValue');
  }
}