@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
16 lines • 689 B
JavaScript
import Color from "color";
var decideContrastColorValue = function (_a) {
var testColor = _a.testColor, _b = _a.lightColor, lightColor = _b === void 0 ? "#fff" : _b, _c = _a.darkColor, darkColor = _c === void 0 ? "#000" : _c;
var contrastColor = "";
try {
contrastColor = Color(testColor).isLight()
? Color(darkColor).rgb().toString()
: Color(lightColor).rgb().toString();
}
catch (ex) {
console.warn("Received invalid colors", { testColor: testColor, lightColor: lightColor, darkColor: darkColor });
}
return contrastColor;
};
export default decideContrastColorValue;
//# sourceMappingURL=colorDecideContrastvalue.js.map