Skip to content

Commit 8d22e3f

Browse files
authored
hotfix: tempfix for autocontrast problem
1 parent ebd0076 commit 8d22e3f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

react_main/src/utilsFolder/autoContrast.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ export function autoContrastColor(sourceColor, backgroundColor, contrastLookup,
5858
if (!contrastLookup) {
5959
return sourceColor;
6060
}
61-
const color = Color(sourceColor);
61+
if (sourceColor == null || sourceColor === '') {
62+
return sourceColor ?? 'inherit';
63+
}
64+
let color;
65+
try {
66+
color = Color(sourceColor);
67+
} catch {
68+
return typeof sourceColor === 'string' ? sourceColor : 'inherit';
69+
}
6270
const target = Color(backgroundColor);
6371
const contrast = target.contrast(color);
6472
if (contrast >= minimumContrast) {

0 commit comments

Comments
 (0)