@gpichot/spectacle-deck 1.2.10 → 1.2.11

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/colors.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare function extractColors(color: string): {
5
5
  r: number;
6
6
  g: number;
7
7
  b: number;
8
- };
8
+ } | null;
9
9
  /**
10
10
  * Create vars for css colors
11
11
  */
package/index.cjs CHANGED
@@ -1331,12 +1331,14 @@ function extractColors(color) {
1331
1331
  const b = parseInt(hex.substring(4, 6), 16);
1332
1332
  return { r, g, b };
1333
1333
  }
1334
- throw new Error(`Invalid color format: ${color}`);
1334
+ return null;
1335
1335
  }
1336
1336
  function createCssVariables(colors) {
1337
1337
  const base = Object.entries(colors).map(([key, value]) => `--color-${key}: ${value};`).join("\n");
1338
1338
  const rgbs = Object.entries(colors).map(([key, value]) => {
1339
- const { r, g, b } = extractColors(value);
1339
+ const color = extractColors(value);
1340
+ if (!color) return "";
1341
+ const { r, g, b } = color;
1340
1342
  return `--color-${key}-rgb: ${r}, ${g}, ${b};`;
1341
1343
  }).join("\n");
1342
1344
  return `${base}
package/index.mjs CHANGED
@@ -1284,12 +1284,14 @@ function extractColors(color) {
1284
1284
  const b = parseInt(hex.substring(4, 6), 16);
1285
1285
  return { r, g, b };
1286
1286
  }
1287
- throw new Error(`Invalid color format: ${color}`);
1287
+ return null;
1288
1288
  }
1289
1289
  function createCssVariables(colors) {
1290
1290
  const base = Object.entries(colors).map(([key, value]) => `--color-${key}: ${value};`).join("\n");
1291
1291
  const rgbs = Object.entries(colors).map(([key, value]) => {
1292
- const { r, g, b } = extractColors(value);
1292
+ const color = extractColors(value);
1293
+ if (!color) return "";
1294
+ const { r, g, b } = color;
1293
1295
  return `--color-${key}-rgb: ${r}, ${g}, ${b};`;
1294
1296
  }).join("\n");
1295
1297
  return `${base}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpichot/spectacle-deck",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.cjs",