Set default color to undefined
This commit is contained in:
parent
58ed2f3706
commit
00a21269dd
1 changed files with 3 additions and 2 deletions
|
@ -5,7 +5,7 @@ export const useFastAverageColor = (
|
||||||
src?: string | null,
|
src?: string | null,
|
||||||
aglorithm?: 'dominant' | 'simple' | 'sqrt',
|
aglorithm?: 'dominant' | 'simple' | 'sqrt',
|
||||||
) => {
|
) => {
|
||||||
const [color, setColor] = useState('rgba(0, 0, 0, 0)');
|
const [color, setColor] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fac = new FastAverageColor();
|
const fac = new FastAverageColor();
|
||||||
|
@ -24,7 +24,8 @@ export const useFastAverageColor = (
|
||||||
return setColor(color.rgb);
|
return setColor(color.rgb);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log(e);
|
console.log('Error fetching average color', e);
|
||||||
|
return setColor('rgba(0, 0, 0, 0)');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue