@tscircuit/pcb-viewer 1.11.237 → 1.11.238

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/index.js CHANGED
@@ -8394,6 +8394,7 @@ var zIndexMap = {
8394
8394
  };
8395
8395
 
8396
8396
  // src/lib/Drawer.ts
8397
+ import colorParser from "color";
8397
8398
  var LAYER_NAME_TO_COLOR = {
8398
8399
  // Standard colors, you shouldn't use these except for testing
8399
8400
  red: "red",
@@ -8762,11 +8763,14 @@ var Drawer = class {
8762
8763
  ctx.lineCap = "round";
8763
8764
  if (mode === "add") {
8764
8765
  ctx.globalCompositeOperation = "source-over";
8765
- let colorString = color2?.[0] === "#" || color2?.startsWith("rgb") ? color2 : LAYER_NAME_TO_COLOR[color2?.toLowerCase()] ? LAYER_NAME_TO_COLOR[color2?.toLowerCase()] : null;
8766
- if (colorString === null) {
8767
- console.warn(`Color mapping for "${color2}" not found`);
8768
- colorString = "white";
8769
- }
8766
+ let colorString = LAYER_NAME_TO_COLOR[color2.toLowerCase()];
8767
+ if (!colorString)
8768
+ try {
8769
+ colorString = colorParser(color2).rgb().toString();
8770
+ } catch (error) {
8771
+ console.warn(`Invalid color format: '${color2}'`);
8772
+ colorString = "white";
8773
+ }
8770
8774
  ctx.fillStyle = colorString;
8771
8775
  ctx.strokeStyle = colorString;
8772
8776
  } else {
@@ -11945,7 +11949,7 @@ import { css as css3 } from "@emotion/css";
11945
11949
  // package.json
11946
11950
  var package_default = {
11947
11951
  name: "@tscircuit/pcb-viewer",
11948
- version: "1.11.236",
11952
+ version: "1.11.237",
11949
11953
  main: "dist/index.js",
11950
11954
  type: "module",
11951
11955
  repository: "tscircuit/pcb-viewer",