altium-toolkit 1.1.39 → 1.1.41

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.
@@ -49,6 +49,12 @@ export class SchematicColorResolver {
49
49
  return normalized
50
50
  }
51
51
 
52
+ if (SchematicColorResolver.#isDefaultInkSourceColor(normalized)) {
53
+ return SchematicColorResolver.#toVariable(
54
+ '--schematic-default-ink-color'
55
+ )
56
+ }
57
+
52
58
  const token = COLOR_TOKEN_BY_VALUE.get(normalized)
53
59
 
54
60
  if (token) {
@@ -316,6 +322,30 @@ export class SchematicColorResolver {
316
322
  return Math.max(rgb.r, rgb.g, rgb.b) <= 32
317
323
  }
318
324
 
325
+ /**
326
+ * Returns true for dark saturated blue source colors that represent
327
+ * Altium's default schematic ink family rather than custom artwork color.
328
+ * @param {string} color Normalized color.
329
+ * @returns {boolean}
330
+ */
331
+ static #isDefaultInkSourceColor(color) {
332
+ const rgb = SchematicColorResolver.#parseHexColor(color)
333
+ if (!rgb) {
334
+ return false
335
+ }
336
+
337
+ const hsl = SchematicColorResolver.#rgbToHsl(rgb)
338
+ const hueDegrees = hsl.h * 360
339
+
340
+ return (
341
+ hueDegrees >= 220 &&
342
+ hueDegrees <= 270 &&
343
+ hsl.s >= 45 &&
344
+ hsl.l >= 12 &&
345
+ hsl.l <= 38
346
+ )
347
+ }
348
+
319
349
  /**
320
350
  * Converts RGB channels to HSL.
321
351
  * @param {{ r: number, g: number, b: number }} color