sprintify-ui 0.12.21 → 0.12.23

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": "sprintify-ui",
3
- "version": "0.12.21",
3
+ "version": "0.12.23",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "generate-llm-txt": "node scripts/generate-llm-txt.js",
@@ -211,7 +211,7 @@ const colorNames = {
211
211
  } as Record<string, string>;
212
212
 
213
213
  export function getColorConfig(color: string, contrast = false): ColorConfig {
214
-
214
+ const originalColor = color;
215
215
  color = colorNames[color] || color;
216
216
 
217
217
  const colorConfig = palette[color]?.[contrast ? 'high' : 'low'];
@@ -220,20 +220,25 @@ export function getColorConfig(color: string, contrast = false): ColorConfig {
220
220
  return colorConfig;
221
221
  }
222
222
 
223
- const c = getContrast(color, 'white');
223
+ try {
224
+ const c = getContrast(color, 'white');
224
225
 
225
- let borderColor = 'transparent';
226
- let textColor = 'white';
226
+ let borderColor = 'transparent';
227
+ let textColor = 'white';
227
228
 
228
- if (c < 2) {
229
- textColor = darken(color, 0.5);
230
- borderColor = darken(color, 0.1);
231
- }
229
+ if (c < 2) {
230
+ textColor = darken(color, 0.5);
231
+ borderColor = darken(color, 0.1);
232
+ }
232
233
 
233
- return {
234
- backgroundColor: color,
235
- textColor: textColor,
236
- borderColor: borderColor,
237
- color: color
238
- };
234
+ return {
235
+ backgroundColor: color,
236
+ textColor: textColor,
237
+ borderColor: borderColor,
238
+ color: color,
239
+ };
240
+ } catch {
241
+ console.warn(`[getColorConfig] "${originalColor}" is not a valid color. Falling back to gray.`);
242
+ return palette.gray[contrast ? 'high' : 'low'];
243
+ }
239
244
  }