@forcecalendar/interface 1.0.47 → 1.0.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/interface",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "type": "module",
5
5
  "description": "Official interface layer for forceCalendar Core - Enterprise calendar components",
6
6
  "main": "dist/force-calendar-interface.umd.js",
@@ -115,40 +115,16 @@ export class BaseViewRenderer {
115
115
  }
116
116
 
117
117
  /**
118
- * Get contrasting text color for a background color
119
- * Uses WCAG luminance formula
118
+ * Get contrasting text color for a background color.
119
+ * Delegates to StyleUtils.getContrastColor() as the single implementation.
120
120
  * @param {string} bgColor - Hex color string
121
- * @returns {string} 'black' or 'white'
121
+ * @returns {string} '#000000' or '#FFFFFF'
122
122
  */
123
123
  getContrastingTextColor(bgColor) {
124
- if (!bgColor || typeof bgColor !== 'string') return 'white';
125
-
126
- const color = bgColor.charAt(0) === '#' ? bgColor.substring(1) : bgColor;
127
-
128
- if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(color)) {
129
- return 'white';
130
- }
131
-
132
- const fullColor =
133
- color.length === 3 ? color[0] + color[0] + color[1] + color[1] + color[2] + color[2] : color;
134
-
135
- const r = parseInt(fullColor.substring(0, 2), 16);
136
- const g = parseInt(fullColor.substring(2, 4), 16);
137
- const b = parseInt(fullColor.substring(4, 6), 16);
138
-
139
- if (isNaN(r) || isNaN(g) || isNaN(b)) {
124
+ if (!bgColor || typeof bgColor !== 'string' || bgColor.charAt(0) !== '#') {
140
125
  return 'white';
141
126
  }
142
-
143
- const uicolors = [r / 255, g / 255, b / 255];
144
- const c = uicolors.map(col => {
145
- if (col <= 0.03928) {
146
- return col / 12.92;
147
- }
148
- return Math.pow((col + 0.055) / 1.055, 2.4);
149
- });
150
- const L = 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
151
- return L > 0.179 ? 'black' : 'white';
127
+ return StyleUtils.getContrastColor(bgColor);
152
128
  }
153
129
 
154
130
  /**