From d3f973e95b67bc33e66d2a1a3697e031f981a1fb Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 25 Mar 2025 23:42:39 +0100 Subject: [PATCH] Improve dynamic theme color performance for large images --- src/modules/manga/components/MangaDetails.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/manga/components/MangaDetails.tsx b/src/modules/manga/components/MangaDetails.tsx index ccc9dbed..bafd3ea3 100644 --- a/src/modules/manga/components/MangaDetails.tsx +++ b/src/modules/manga/components/MangaDetails.tsx @@ -187,11 +187,13 @@ const Thumbnail = ({ img.src = Mangas.getThumbnailUrl(manga); img.onload = () => { + const isLargeImage = img.width > 600 && img.height > 600; + Promise.all([ Vibrant.from(img).getPalette(), - new FastAverageColor().getColorAsync(img, { + new FastAverageColor().getColor(img, { algorithm: 'dominant', - mode: 'precision', + mode: isLargeImage ? 'speed' : 'precision', ignoredColor: [ [255, 255, 255, 255, 75], [0, 0, 0, 255, 75],