@leanix/components 0.2.228 → 0.2.229
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/leanix-components.umd.js +17 -5
- package/bundles/leanix-components.umd.js.map +1 -1
- package/esm2015/lib/core-ui/functions/core-css.helpers.js +17 -5
- package/esm2015/lib/core-ui/functions/core-css.helpers.js.map +1 -1
- package/fesm2015/leanix-components.js +17 -5
- package/fesm2015/leanix-components.js.map +1 -1
- package/lib/core-ui/functions/core-css.helpers.d.ts +7 -0
- package/package.json +1 -1
@@ -1328,12 +1328,24 @@
|
|
1328
1328
|
type: i0.Input
|
1329
1329
|
}] } });
|
1330
1330
|
|
1331
|
+
/**
|
1332
|
+
* Compute the most eligible text color for a given background color (black or white), depending on the luminance of the
|
1333
|
+
* background color. In case the provided color is undefined or invalid, white (#FFFFFF) is returned.
|
1334
|
+
*
|
1335
|
+
* @param colorHex Color string in hexadecimal encoding.
|
1336
|
+
* @returns Equivalent contrast color in hexadecimal encoding.
|
1337
|
+
*/
|
1331
1338
|
function getContrastColor(colorHex) {
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1339
|
+
try {
|
1340
|
+
var color = Color__namespace(colorHex || '#000');
|
1341
|
+
// Check http://codepen.io/WebSeed/pen/pvgqEq
|
1342
|
+
var a = 1 - (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;
|
1343
|
+
var d = a < 0.4 ? 0 : 255;
|
1344
|
+
return Color__namespace({ r: d, g: d, b: d }).hex();
|
1345
|
+
}
|
1346
|
+
catch (_a) {
|
1347
|
+
return '#FFFFFF';
|
1348
|
+
}
|
1337
1349
|
}
|
1338
1350
|
function shorthandHexHandle(hex) {
|
1339
1351
|
var shorthandRegex = /^(#)([a-f\d])([a-f\d])([a-f\d])$/i;
|