@bimdata/design-system 1.4.0-rc.18 → 1.4.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/colors.js +30 -1
- package/dist/css/design-system.css +243 -243
- package/dist/js/BIMDataComponents/BIMDataCarousel.js +1 -1
- package/dist/js/BIMDataComponents/BIMDataIcon.js +1 -1
- package/dist/js/BIMDataComponents/BIMDataSafeZoneModal.js +1 -1
- package/dist/js/BIMDataComponents/index.js +1 -1
- package/dist/js/BIMDataComponents/vue3/BIMDataCarousel.js +1 -1
- package/dist/js/BIMDataComponents/vue3/BIMDataIcon.js +1 -1
- package/dist/js/BIMDataComponents/vue3/BIMDataSafeZoneModal.js +1 -1
- package/dist/js/BIMDataComponents/vue3/index.js +1 -1
- package/dist/js/BIMDataSmartComponents/BIMDataFileManager.js +1 -1
- package/package.json +1 -1
package/dist/colors.js
CHANGED
|
@@ -50,4 +50,33 @@ function getRandomHexColor() {
|
|
|
50
50
|
return validColors[index][1];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
// https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html
|
|
54
|
+
// https://www.w3.org/TR/AERT/#color-contrast
|
|
55
|
+
function adjustTextColor(bgColor, lightTextColor, darkTextColor) {
|
|
56
|
+
const color = bgColor.charAt(0) === "#" ? bgColor.substring(1, 7) : bgColor;
|
|
57
|
+
// hex to R
|
|
58
|
+
const r = parseInt(color.substring(0, 2), 16);
|
|
59
|
+
// hex to G
|
|
60
|
+
const g = parseInt(color.substring(2, 4), 16);
|
|
61
|
+
// hex to B
|
|
62
|
+
const b = parseInt(color.substring(4, 6), 16);
|
|
63
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186
|
|
64
|
+
? darkTextColor
|
|
65
|
+
: lightTextColor;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function adjustBorderColor(color, amount) {
|
|
69
|
+
return (
|
|
70
|
+
"#" +
|
|
71
|
+
color
|
|
72
|
+
.replace(/^#/, "")
|
|
73
|
+
.replace(/../g, color =>
|
|
74
|
+
(
|
|
75
|
+
"0" +
|
|
76
|
+
Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)
|
|
77
|
+
).slice(-2)
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { colors, getRandomHexColor, adjustTextColor, adjustBorderColor };
|