Improve dynamic theme color performance for large images
This commit is contained in:
@@ -187,11 +187,13 @@ const Thumbnail = ({
|
|||||||
img.src = Mangas.getThumbnailUrl(manga);
|
img.src = Mangas.getThumbnailUrl(manga);
|
||||||
|
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
|
const isLargeImage = img.width > 600 && img.height > 600;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
Vibrant.from(img).getPalette(),
|
Vibrant.from(img).getPalette(),
|
||||||
new FastAverageColor().getColorAsync(img, {
|
new FastAverageColor().getColor(img, {
|
||||||
algorithm: 'dominant',
|
algorithm: 'dominant',
|
||||||
mode: 'precision',
|
mode: isLargeImage ? 'speed' : 'precision',
|
||||||
ignoredColor: [
|
ignoredColor: [
|
||||||
[255, 255, 255, 255, 75],
|
[255, 255, 255, 255, 75],
|
||||||
[0, 0, 0, 255, 75],
|
[0, 0, 0, 255, 75],
|
||||||
|
|||||||
Reference in New Issue
Block a user