Function: averageColour()
averageColour(
pixels):string|undefined
Defined in: src/lib/rendering/sample/index.ts:43
The average colour of RGBA pixels, counting every pixel that isn't fully transparent (transparent pixels are outside the canvas). Undefined if all are transparent.
Parameters
pixels
Uint8ClampedArray
Returns
string | undefined
Example
averageColour(new Uint8ClampedArray([255, 0, 0, 255, 0, 0, 255, 255])); // "#800080"