From 68794bf1848c43c41b6e7f52c694bba989c34710 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 4 Aug 2023 10:22:08 +0800 Subject: [PATCH] Fix colors.length modulus --- packages/web/components/patterns/LibraryCards/FallbackImage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/components/patterns/LibraryCards/FallbackImage.tsx b/packages/web/components/patterns/LibraryCards/FallbackImage.tsx index 28574bb9f..8cdc64aaa 100644 --- a/packages/web/components/patterns/LibraryCards/FallbackImage.tsx +++ b/packages/web/components/patterns/LibraryCards/FallbackImage.tsx @@ -9,7 +9,7 @@ type FallbackImageProps = { export const FallbackImage = (props: FallbackImageProps): JSX.Element => { console.log('checking title: ', props.title) - const idx = (Math.abs(hashCode(props.title)) % Colors.length) - 1 + const idx = Math.abs(hashCode(props.title)) % (Colors.length - 1) console.log('title', props.title, 'idx: ', idx) const color = Colors[idx] console.log('color:', color)