From 8ecccd63d8b344ae967f3e2e8e8d780c795fa1f5 Mon Sep 17 00:00:00 2001 From: Hatem Hosny Date: Sat, 23 Nov 2024 14:37:48 +0200 Subject: [PATCH] fix theme color on firefox --- src/livecodes/UI/theme-colors.ts | 2 +- src/livecodes/core.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/livecodes/UI/theme-colors.ts b/src/livecodes/UI/theme-colors.ts index b9a5dc97a..2c49dce38 100644 --- a/src/livecodes/UI/theme-colors.ts +++ b/src/livecodes/UI/theme-colors.ts @@ -7,4 +7,4 @@ export const themeColors = [ { name: 'violet', themeColor: 'hsl(262, 40%, 50%)' }, { name: 'slate', themeColor: 'hsl(220, 20%, 50%)' }, { name: 'custom', themeColor: undefined }, -]; +] as const; diff --git a/src/livecodes/core.ts b/src/livecodes/core.ts index ca8ce74ec..8f62b00cf 100644 --- a/src/livecodes/core.ts +++ b/src/livecodes/core.ts @@ -1806,6 +1806,9 @@ const getDefaultColor = () => { if (theme === 'light') { root.classList.add('light'); } + if (h === '' || s === '' || l === '') { + return themeColors[0].themeColor; + } defaultColor = `hsl(${h}, ${s}, ${l})`; return defaultColor; };