chromonym 1.4.1 → 2.0.0

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.
Files changed (106) hide show
  1. package/NOTICE.md +32 -4
  2. package/README.md +216 -75
  3. package/dist/conversions/hex.d.ts +1 -1
  4. package/dist/conversions/hex.d.ts.map +1 -1
  5. package/dist/conversions/hex.js +2 -2
  6. package/dist/conversions/hex.js.map +1 -1
  7. package/dist/conversions/hsl.d.ts +1 -1
  8. package/dist/conversions/hsl.d.ts.map +1 -1
  9. package/dist/conversions/hsl.js +2 -2
  10. package/dist/conversions/hsl.js.map +1 -1
  11. package/dist/conversions/hsv.d.ts +1 -1
  12. package/dist/conversions/hsv.d.ts.map +1 -1
  13. package/dist/conversions/hsv.js +2 -2
  14. package/dist/conversions/hsv.js.map +1 -1
  15. package/dist/conversions/index.d.ts +5 -5
  16. package/dist/conversions/index.d.ts.map +1 -1
  17. package/dist/conversions/index.js +5 -5
  18. package/dist/conversions/index.js.map +1 -1
  19. package/dist/conversions/pantone.d.ts +9 -7
  20. package/dist/conversions/pantone.d.ts.map +1 -1
  21. package/dist/conversions/pantone.js +11 -10
  22. package/dist/conversions/pantone.js.map +1 -1
  23. package/dist/conversions/rgb.d.ts +1 -1
  24. package/dist/conversions/rgb.d.ts.map +1 -1
  25. package/dist/conversions/rgb.js +1 -1
  26. package/dist/conversions/rgb.js.map +1 -1
  27. package/dist/convert.d.ts +45 -5
  28. package/dist/convert.d.ts.map +1 -1
  29. package/dist/convert.js +68 -17
  30. package/dist/convert.js.map +1 -1
  31. package/dist/detectFormat.d.ts +1 -1
  32. package/dist/detectFormat.d.ts.map +1 -1
  33. package/dist/detectFormat.js +2 -6
  34. package/dist/detectFormat.js.map +1 -1
  35. package/dist/identify.d.ts +13 -16
  36. package/dist/identify.d.ts.map +1 -1
  37. package/dist/identify.js +12 -12
  38. package/dist/identify.js.map +1 -1
  39. package/dist/index.d.ts +14 -14
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +13 -13
  42. package/dist/index.js.map +1 -1
  43. package/dist/indexing.d.ts +30 -24
  44. package/dist/indexing.d.ts.map +1 -1
  45. package/dist/indexing.js +49 -22
  46. package/dist/indexing.js.map +1 -1
  47. package/dist/math/clamp.d.ts.map +1 -1
  48. package/dist/math/clamp.js.map +1 -1
  49. package/dist/math/colorSpace.d.ts +1 -1
  50. package/dist/math/colorSpace.d.ts.map +1 -1
  51. package/dist/math/colorSpace.js.map +1 -1
  52. package/dist/math/deltaE.d.ts.map +1 -1
  53. package/dist/math/deltaE.js.map +1 -1
  54. package/dist/math/euclideanDistance.d.ts +1 -1
  55. package/dist/math/euclideanDistance.d.ts.map +1 -1
  56. package/dist/math/euclideanDistance.js.map +1 -1
  57. package/dist/math/hueSector.d.ts.map +1 -1
  58. package/dist/math/hueSector.js.map +1 -1
  59. package/dist/palettes/index.d.ts +4 -0
  60. package/dist/palettes/index.d.ts.map +1 -0
  61. package/dist/palettes/index.js +4 -0
  62. package/dist/palettes/index.js.map +1 -0
  63. package/dist/palettes/normalize.d.ts +17 -0
  64. package/dist/palettes/normalize.d.ts.map +1 -0
  65. package/dist/palettes/normalize.js +19 -0
  66. package/dist/palettes/normalize.js.map +1 -0
  67. package/dist/palettes/pantone.d.ts +1834 -0
  68. package/dist/palettes/pantone.d.ts.map +1 -0
  69. package/dist/palettes/pantone.js +925 -0
  70. package/dist/palettes/pantone.js.map +1 -0
  71. package/dist/palettes/web.d.ts +320 -0
  72. package/dist/palettes/web.d.ts.map +1 -0
  73. package/dist/{colorspaces → palettes}/web.js +18 -3
  74. package/dist/palettes/web.js.map +1 -0
  75. package/dist/palettes/x11.d.ts +1346 -0
  76. package/dist/palettes/x11.d.ts.map +1 -0
  77. package/dist/palettes/x11.js +686 -0
  78. package/dist/palettes/x11.js.map +1 -0
  79. package/dist/resolve.d.ts +9 -7
  80. package/dist/resolve.d.ts.map +1 -1
  81. package/dist/resolve.js +18 -17
  82. package/dist/resolve.js.map +1 -1
  83. package/dist/types.d.ts +10 -6
  84. package/dist/types.d.ts.map +1 -1
  85. package/dist/types.js +2 -1
  86. package/dist/types.js.map +1 -1
  87. package/package.json +32 -18
  88. package/dist/colorspaces/index.d.ts +0 -4
  89. package/dist/colorspaces/index.d.ts.map +0 -1
  90. package/dist/colorspaces/index.js +0 -4
  91. package/dist/colorspaces/index.js.map +0 -1
  92. package/dist/colorspaces/pantone.d.ts +0 -919
  93. package/dist/colorspaces/pantone.d.ts.map +0 -1
  94. package/dist/colorspaces/pantone.js +0 -918
  95. package/dist/colorspaces/pantone.js.map +0 -1
  96. package/dist/colorspaces/registry.d.ts +0 -26
  97. package/dist/colorspaces/registry.d.ts.map +0 -1
  98. package/dist/colorspaces/registry.js +0 -36
  99. package/dist/colorspaces/registry.js.map +0 -1
  100. package/dist/colorspaces/web.d.ts +0 -156
  101. package/dist/colorspaces/web.d.ts.map +0 -1
  102. package/dist/colorspaces/web.js.map +0 -1
  103. package/dist/colorspaces/x11.d.ts +0 -667
  104. package/dist/colorspaces/x11.d.ts.map +0 -1
  105. package/dist/colorspaces/x11.js +0 -666
  106. package/dist/colorspaces/x11.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hueSector.js","sourceRoot":"","sources":["../../src/math/hueSector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,MAAc,EACd,SAAiB;IAEjB,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"hueSector.js","sourceRoot":"","sources":["../../src/math/hueSector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,MAAc,EACd,SAAiB;IAEjB,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Map a normalized hue sector value (range [0, 6)) plus chroma and its\n * secondary into the primary-color tuple `[r', g', b']` used by the\n * standard HSL→RGB and HSV→RGB algorithms. Each component is in [0, chroma].\n *\n * Shared by `hslToRgba` and `hsvToRgba`: same six-sector table, different\n * formulas for chroma and the offset. The caller adds the offset and\n * scales by 255.\n *\n * hueSector = h / 60 (h wrapped to [0, 360))\n * chroma = HSL: (1 − |2l − 1|)·s ; HSV: v·s\n * secondary = chroma · (1 − |hueSector mod 2 − 1|)\n */\nexport function hueSectorToPrime(\n hueSector: number,\n chroma: number,\n secondary: number,\n): [number, number, number] {\n if (hueSector < 1) return [chroma, secondary, 0];\n if (hueSector < 2) return [secondary, chroma, 0];\n if (hueSector < 3) return [0, chroma, secondary];\n if (hueSector < 4) return [0, secondary, chroma];\n if (hueSector < 5) return [secondary, 0, chroma];\n return [chroma, 0, secondary];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { type PantoneColorName, pantone } from './pantone.js';
2
+ export { type WebColorName, web } from './web.js';
3
+ export { type X11ColorName, x11 } from './x11.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/palettes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,KAAK,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { type PantoneColorName, pantone } from './pantone.js';\nexport { type WebColorName, web } from './web.js';\nexport { type X11ColorName, x11 } from './x11.js';\n"]}
@@ -0,0 +1,4 @@
1
+ export { pantone } from './pantone.js';
2
+ export { web } from './web.js';
3
+ export { x11 } from './x11.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/palettes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAqB,GAAG,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAqB,GAAG,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { type PantoneColorName, pantone } from './pantone.js';\nexport { type WebColorName, web } from './web.js';\nexport { type X11ColorName, x11 } from './x11.js';\n"]}
@@ -0,0 +1,17 @@
1
+ import type { NormalizeFn } from '../types.js';
2
+ /**
3
+ * Name normalizers used by palettes.
4
+ *
5
+ * Tree-shake note: this module has zero imports beyond a type. Palette
6
+ * modules (`web`, `x11`, `pantone`, or user BYO palettes) can reference
7
+ * these without dragging in the full `indexing.ts` graph, which pulls
8
+ * math modules needed only when `identify` / `resolve` actually runs.
9
+ */
10
+ /** Lowercase + strip non-alphanumeric. Works for web, x11, and most BYO. */
11
+ export declare const standardNormalize: NormalizeFn;
12
+ /**
13
+ * Pantone: also strip a leading "Pantone" or "PMS" prefix so that
14
+ * "185 C", "185c", "Pantone 185 C", "PMS185C" all map to "185c".
15
+ */
16
+ export declare const pantoneNormalize: NormalizeFn;
17
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/palettes/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;GAOG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,WAA8D,CAAC;AAE/F;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAID,CAAC","sourcesContent":["import type { NormalizeFn } from '../types.js';\n\n/**\n * Name normalizers used by palettes.\n *\n * Tree-shake note: this module has zero imports beyond a type. Palette\n * modules (`web`, `x11`, `pantone`, or user BYO palettes) can reference\n * these without dragging in the full `indexing.ts` graph, which pulls\n * math modules needed only when `identify` / `resolve` actually runs.\n */\n\n/** Lowercase + strip non-alphanumeric. Works for web, x11, and most BYO. */\nexport const standardNormalize: NormalizeFn = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '');\n\n/**\n * Pantone: also strip a leading \"Pantone\" or \"PMS\" prefix so that\n * \"185 C\", \"185c\", \"Pantone 185 C\", \"PMS185C\" all map to \"185c\".\n */\nexport const pantoneNormalize: NormalizeFn = (s) =>\n s\n .toLowerCase()\n .replace(/^(pantone|pms)\\s*/, '')\n .replace(/[^a-z0-9]/g, '');\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Name normalizers used by palettes.
3
+ *
4
+ * Tree-shake note: this module has zero imports beyond a type. Palette
5
+ * modules (`web`, `x11`, `pantone`, or user BYO palettes) can reference
6
+ * these without dragging in the full `indexing.ts` graph, which pulls
7
+ * math modules needed only when `identify` / `resolve` actually runs.
8
+ */
9
+ /** Lowercase + strip non-alphanumeric. Works for web, x11, and most BYO. */
10
+ export const standardNormalize = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '');
11
+ /**
12
+ * Pantone: also strip a leading "Pantone" or "PMS" prefix so that
13
+ * "185 C", "185c", "Pantone 185 C", "PMS185C" all map to "185c".
14
+ */
15
+ export const pantoneNormalize = (s) => s
16
+ .toLowerCase()
17
+ .replace(/^(pantone|pms)\s*/, '')
18
+ .replace(/[^a-z0-9]/g, '');
19
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/palettes/normalize.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAE/F;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgB,CAAC,CAAC,EAAE,EAAE,CACjD,CAAC;KACE,WAAW,EAAE;KACb,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC;KAChC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type { NormalizeFn } from '../types.js';\n\n/**\n * Name normalizers used by palettes.\n *\n * Tree-shake note: this module has zero imports beyond a type. Palette\n * modules (`web`, `x11`, `pantone`, or user BYO palettes) can reference\n * these without dragging in the full `indexing.ts` graph, which pulls\n * math modules needed only when `identify` / `resolve` actually runs.\n */\n\n/** Lowercase + strip non-alphanumeric. Works for web, x11, and most BYO. */\nexport const standardNormalize: NormalizeFn = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '');\n\n/**\n * Pantone: also strip a leading \"Pantone\" or \"PMS\" prefix so that\n * \"185 C\", \"185c\", \"Pantone 185 C\", \"PMS185C\" all map to \"185c\".\n */\nexport const pantoneNormalize: NormalizeFn = (s) =>\n s\n .toLowerCase()\n .replace(/^(pantone|pms)\\s*/, '')\n .replace(/[^a-z0-9]/g, '');\n"]}