From e1ee0bd5f92b2509e823cd55e6af06a326aaef15 Mon Sep 17 00:00:00 2001 From: happycastle <41810556+happycastle114@users.noreply.github.com> Date: Fri, 1 Dec 2023 02:33:58 +0900 Subject: [PATCH] Add: color fix --- src/utils/color.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/color.ts b/src/utils/color.ts index 3e4977a..06afe32 100644 --- a/src/utils/color.ts +++ b/src/utils/color.ts @@ -33,6 +33,9 @@ export const majorBlend = ( data: { weight: number; color: Color }[], base: Color = { r: 0xff, g: 0xff, b: 0xff }, ) => { + if (data.length === 1) { + return data[0].color; + } const major = data.reduce((a, b) => (a.weight > b.weight ? a : b), { weight: 0, color: { r: 0, g: 0, b: 0 },