@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
15 lines (14 loc) • 438 B
JavaScript
import { cssVar } from "antd-style";
import { readableColor } from "polished";
//#region src/utils/safeReadableColor.ts
const safeReadableColor = (bgColor, fallbackColor) => {
try {
return readableColor(bgColor);
} catch {
if (bgColor.startsWith("var(")) return `contrast-color(${bgColor})`;
return fallbackColor || cssVar.colorText;
}
};
//#endregion
export { safeReadableColor };
//# sourceMappingURL=safeReadableColor.mjs.map