Improve average color matching

- Add threshold to ignored white/black values
- Add ignored transparency colors
This commit is contained in:
jeffvli 2023-01-06 01:05:54 -08:00
parent 1b379882f5
commit 083e219ed2

View file

@ -16,10 +16,11 @@ export const useFastAverageColor = (
.getColorAsync(src, {
algorithm: aglorithm || 'dominant',
ignoredColor: [
[255, 255, 255, 255], // White
[0, 0, 0, 255], // Black
[255, 255, 255, 255, 40], // White
[0, 0, 0, 255, 20], // Black
[0, 0, 0, 0, 20], // Transparent
],
mode: 'precision',
mode: 'speed',
})
.then((color) => {
return setColor(color.rgb);