Improve average color matching
- Add threshold to ignored white/black values - Add ignored transparency colors
This commit is contained in:
parent
1b379882f5
commit
083e219ed2
1 changed files with 4 additions and 3 deletions
|
@ -16,10 +16,11 @@ export const useFastAverageColor = (
|
||||||
.getColorAsync(src, {
|
.getColorAsync(src, {
|
||||||
algorithm: aglorithm || 'dominant',
|
algorithm: aglorithm || 'dominant',
|
||||||
ignoredColor: [
|
ignoredColor: [
|
||||||
[255, 255, 255, 255], // White
|
[255, 255, 255, 255, 40], // White
|
||||||
[0, 0, 0, 255], // Black
|
[0, 0, 0, 255, 20], // Black
|
||||||
|
[0, 0, 0, 0, 20], // Transparent
|
||||||
],
|
],
|
||||||
mode: 'precision',
|
mode: 'speed',
|
||||||
})
|
})
|
||||||
.then((color) => {
|
.then((color) => {
|
||||||
return setColor(color.rgb);
|
return setColor(color.rgb);
|
||||||
|
|
Reference in a new issue