Fix default theme fallback when an invalid theme is passed (#15)

* fix(color): invalid theme fallback to default

Fixes: #4641

* test(color): add test case for invalid theme fallback to default

* style(color): add back the tab space

* test(color): fix color default theme

* fix(color): use 'in' instead of '.hasOwnProperty'

* fix new test

* format code

---------

Co-authored-by: mikyll <righi.michy@gmail.com>
This commit is contained in:
martin-mfg
2026-01-19 18:59:32 +01:00
committed by GitHub
co-authored by mikyll
parent 17e6aee8fc
commit b654eaac2c
2 changed files with 16 additions and 1 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ const getCardColors = ({
theme,
}) => {
const defaultTheme = themes["default"];
const isThemeProvided = theme !== null && theme !== undefined;
const isThemeProvided =
theme !== null && theme !== undefined && theme in themes;
// @ts-ignore
const selectedTheme = isThemeProvided ? themes[theme] : defaultTheme;