From 47b6c81a8d84cc5c3c44ec2d05367056ca35a5a8 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Wed, 24 Dec 2025 17:27:25 +0200 Subject: [PATCH] fix(config): guard banner backgroundColor parsing --- src/config.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config.ts b/src/config.ts index c6f50559..ab5fc63d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -288,9 +288,13 @@ async function parseBanner(banner: Banner): Promise | undefined> { if (typeof banner === 'string') return undefined if (typeof banner === 'object') { if ('textColor' in banner) return banner.textColor - if ('backgroundColor' in banner && banner.backgroundColor) { - const chroma = (await import('chroma-js')).default - return chroma.contrast(banner.backgroundColor, 'white') < 4.5 ? 'black' : 'white' + if ('backgroundColor' in banner && typeof banner.backgroundColor === 'string') { + try { + const chroma = (await import('chroma-js')).default + return chroma.contrast(banner.backgroundColor, 'white') < 4.5 ? 'black' : 'white' + } catch { + return undefined + } } } return undefined