Skip to content

Commit bf1bbc0

Browse files
2 parents e635e2e + 69ef373 commit bf1bbc0

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/ui/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export { default as popoverOverflowModifiers } from "./utils/popoverOverflowModi
4141
export * from "./utils/tgFormValues";
4242
export { default as tgFormValues } from "./utils/tgFormValues";
4343
export { default as withStore } from "./utils/withStore";
44+
export { default as determineBlackOrWhiteTextColor } from "./utils/determineBlackOrWhiteTextColor";
4445
export {
4546
default as withTableParams,
4647
useTableParams
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
22
import Color from "color";
33

4-
export default c => (Color(c).isLight() ? "#000000" : "#FFFFFF");
4+
export default function determineBlackOrWhiteTextColor(c) {
5+
try {
6+
return Color(c).isLight() ? "#000000" : "#FFFFFF";
7+
} catch (e) {
8+
console.error("Error in color parsing:", e);
9+
return "#000000"; // Fallback to black if color parsing fails
10+
}
11+
}

0 commit comments

Comments
 (0)