color-map 2.2.0 → 2.3.1

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 (366) hide show
  1. package/.claude-plugin/plugin.json +12 -0
  2. package/.codex-plugin/plugin.json +12 -0
  3. package/.cursor-plugin/plugin.json +12 -0
  4. package/CHANGELOG.md +100 -0
  5. package/README.md +71 -8
  6. package/bin/cli-CELmx3Y9.js +6414 -0
  7. package/bin/color-map.js +9 -0
  8. package/bin/index.js +1 -0
  9. package/cjs/color/index.d.ts +5 -0
  10. package/cjs/color/index.js +52 -0
  11. package/cjs/color-wNrkrhC7.js +374 -0
  12. package/cjs/color-wNrkrhC7.js.map +1 -0
  13. package/cjs/contrast-XjF5Rwui.js +293 -0
  14. package/cjs/contrast-XjF5Rwui.js.map +1 -0
  15. package/cjs/gamut-CG1J2aat.d.ts +158 -0
  16. package/cjs/gamut-CG1J2aat.d.ts.map +1 -0
  17. package/cjs/index-BcEqCPHz.d.ts +137 -0
  18. package/cjs/index-BcEqCPHz.d.ts.map +1 -0
  19. package/cjs/index-CGKCqRqD.d.ts +111 -0
  20. package/cjs/index-CGKCqRqD.d.ts.map +1 -0
  21. package/cjs/index-Cv3iUUYE.d.ts +171 -0
  22. package/cjs/index-Cv3iUUYE.d.ts.map +1 -0
  23. package/cjs/index-Dw43Hj4v.d.ts +41 -0
  24. package/cjs/index-Dw43Hj4v.d.ts.map +1 -0
  25. package/cjs/index-Dy8UARqO.d.ts +72 -0
  26. package/cjs/index-Dy8UARqO.d.ts.map +1 -0
  27. package/cjs/index.d.ts +26 -36
  28. package/cjs/index.d.ts.map +1 -1
  29. package/cjs/index.js +83 -62
  30. package/cjs/index.js.map +1 -1
  31. package/cjs/legacy/index.d.ts +2 -0
  32. package/cjs/legacy/index.js +75 -0
  33. package/cjs/legacy/index.js.map +1 -0
  34. package/cjs/mix-Cs4owSbW.js +158 -0
  35. package/cjs/mix-Cs4owSbW.js.map +1 -0
  36. package/cjs/mix-DGlKoUw4.d.ts +31 -0
  37. package/cjs/mix-DGlKoUw4.d.ts.map +1 -0
  38. package/cjs/palette/index.d.ts +3 -0
  39. package/cjs/palette/index.js +8 -0
  40. package/cjs/palette-DyFV_KoJ.js +332 -0
  41. package/cjs/palette-DyFV_KoJ.js.map +1 -0
  42. package/cjs/parse-8mt2OMKf.js +1508 -0
  43. package/cjs/parse-8mt2OMKf.js.map +1 -0
  44. package/cjs/scale/index.d.ts +2 -0
  45. package/cjs/scale/index.js +11 -0
  46. package/cjs/scale-Cq9pXrc1.js +318 -0
  47. package/cjs/scale-Cq9pXrc1.js.map +1 -0
  48. package/cjs/semantic-CrEIo8tS.d.ts +52 -0
  49. package/cjs/semantic-CrEIo8tS.d.ts.map +1 -0
  50. package/cjs/serialize-C69DAmoE.d.ts +25 -0
  51. package/cjs/serialize-C69DAmoE.d.ts.map +1 -0
  52. package/cjs/serialize-Ci2X0cPN.js +103 -0
  53. package/cjs/serialize-Ci2X0cPN.js.map +1 -0
  54. package/cjs/tokens/index.d.ts +2 -0
  55. package/cjs/tokens/index.js +6 -0
  56. package/cjs/tokens-CzXxaMgM.js +168 -0
  57. package/cjs/tokens-CzXxaMgM.js.map +1 -0
  58. package/cjs/tone-BAhu-QzQ.js +118 -0
  59. package/cjs/tone-BAhu-QzQ.js.map +1 -0
  60. package/dist/color-map.es5.js.map +1 -1
  61. package/esm/color/a98-rgb.d.ts +7 -0
  62. package/esm/color/a98-rgb.d.ts.map +1 -0
  63. package/esm/color/a98-rgb.js +13 -0
  64. package/esm/color/a98-rgb.js.map +1 -0
  65. package/esm/color/argb.d.ts +6 -0
  66. package/esm/color/argb.d.ts.map +1 -0
  67. package/esm/color/argb.js +25 -0
  68. package/esm/color/argb.js.map +1 -0
  69. package/esm/color/calc.js +82 -0
  70. package/esm/color/calc.js.map +1 -0
  71. package/esm/color/compare.d.ts +20 -0
  72. package/esm/color/compare.d.ts.map +1 -0
  73. package/esm/color/compare.js +46 -0
  74. package/esm/color/compare.js.map +1 -0
  75. package/esm/color/contrast.d.ts +107 -0
  76. package/esm/color/contrast.d.ts.map +1 -0
  77. package/esm/color/contrast.js +242 -0
  78. package/esm/color/contrast.js.map +1 -0
  79. package/esm/color/convert.d.ts +9 -0
  80. package/esm/color/convert.d.ts.map +1 -0
  81. package/esm/color/convert.js +45 -0
  82. package/esm/color/convert.js.map +1 -0
  83. package/esm/color/display-p3-linear.d.ts +7 -0
  84. package/esm/color/display-p3-linear.d.ts.map +1 -0
  85. package/esm/color/display-p3-linear.js +12 -0
  86. package/esm/color/display-p3-linear.js.map +1 -0
  87. package/esm/color/display-p3.d.ts +7 -0
  88. package/esm/color/display-p3.d.ts.map +1 -0
  89. package/esm/color/display-p3.js +12 -0
  90. package/esm/color/display-p3.js.map +1 -0
  91. package/esm/color/expr.d.ts +43 -0
  92. package/esm/color/expr.d.ts.map +1 -0
  93. package/esm/color/expr.js +160 -0
  94. package/esm/color/expr.js.map +1 -0
  95. package/esm/color/gamut.d.ts +31 -0
  96. package/esm/color/gamut.d.ts.map +1 -0
  97. package/esm/color/gamut.js +210 -0
  98. package/esm/color/gamut.js.map +1 -0
  99. package/esm/color/hsl.d.ts +7 -0
  100. package/esm/color/hsl.d.ts.map +1 -0
  101. package/esm/color/hsl.js +67 -0
  102. package/esm/color/hsl.js.map +1 -0
  103. package/esm/color/hwb.d.ts +7 -0
  104. package/esm/color/hwb.d.ts.map +1 -0
  105. package/esm/color/hwb.js +40 -0
  106. package/esm/color/hwb.js.map +1 -0
  107. package/esm/color/index.d.ts +28 -0
  108. package/esm/color/index.js +27 -0
  109. package/esm/color/lab.d.ts +7 -0
  110. package/esm/color/lab.d.ts.map +1 -0
  111. package/esm/color/lab.js +33 -0
  112. package/esm/color/lab.js.map +1 -0
  113. package/esm/color/lch.d.ts +7 -0
  114. package/esm/color/lch.d.ts.map +1 -0
  115. package/esm/color/lch.js +11 -0
  116. package/esm/color/lch.js.map +1 -0
  117. package/esm/color/math.js +32 -0
  118. package/esm/color/math.js.map +1 -0
  119. package/esm/color/matrices.js +180 -0
  120. package/esm/color/matrices.js.map +1 -0
  121. package/esm/color/mix.d.ts +30 -0
  122. package/esm/color/mix.d.ts.map +1 -0
  123. package/esm/color/mix.js +152 -0
  124. package/esm/color/mix.js.map +1 -0
  125. package/esm/color/named.js +11 -0
  126. package/esm/color/named.js.map +1 -0
  127. package/esm/color/oklab.d.ts +7 -0
  128. package/esm/color/oklab.d.ts.map +1 -0
  129. package/esm/color/oklab.js +21 -0
  130. package/esm/color/oklab.js.map +1 -0
  131. package/esm/color/oklch.d.ts +7 -0
  132. package/esm/color/oklch.d.ts.map +1 -0
  133. package/esm/color/oklch.js +11 -0
  134. package/esm/color/oklch.js.map +1 -0
  135. package/esm/color/parse.d.ts +9 -0
  136. package/esm/color/parse.d.ts.map +1 -0
  137. package/esm/color/parse.js +452 -0
  138. package/esm/color/parse.js.map +1 -0
  139. package/esm/color/polar.js +27 -0
  140. package/esm/color/polar.js.map +1 -0
  141. package/esm/color/prophoto-rgb.d.ts +7 -0
  142. package/esm/color/prophoto-rgb.d.ts.map +1 -0
  143. package/esm/color/prophoto-rgb.js +18 -0
  144. package/esm/color/prophoto-rgb.js.map +1 -0
  145. package/esm/color/rec2020.d.ts +7 -0
  146. package/esm/color/rec2020.d.ts.map +1 -0
  147. package/esm/color/rec2020.js +13 -0
  148. package/esm/color/rec2020.js.map +1 -0
  149. package/esm/color/resolve.d.ts +18 -0
  150. package/esm/color/resolve.d.ts.map +1 -0
  151. package/esm/color/resolve.js +98 -0
  152. package/esm/color/resolve.js.map +1 -0
  153. package/esm/color/rgb.js +20 -0
  154. package/esm/color/rgb.js.map +1 -0
  155. package/esm/color/serialize.d.ts +24 -0
  156. package/esm/color/serialize.d.ts.map +1 -0
  157. package/esm/color/serialize.js +88 -0
  158. package/esm/color/serialize.js.map +1 -0
  159. package/esm/color/spaces.d.ts +6 -0
  160. package/esm/color/spaces.d.ts.map +1 -0
  161. package/esm/color/spaces.js +42 -0
  162. package/esm/color/spaces.js.map +1 -0
  163. package/esm/color/srgb-linear.d.ts +7 -0
  164. package/esm/color/srgb-linear.d.ts.map +1 -0
  165. package/esm/color/srgb-linear.js +12 -0
  166. package/esm/color/srgb-linear.js.map +1 -0
  167. package/esm/color/srgb.d.ts +7 -0
  168. package/esm/color/srgb.d.ts.map +1 -0
  169. package/esm/color/srgb.js +12 -0
  170. package/esm/color/srgb.js.map +1 -0
  171. package/esm/color/transfer.js +11 -0
  172. package/esm/color/transfer.js.map +1 -0
  173. package/esm/color/types.d.ts +23 -0
  174. package/esm/color/types.d.ts.map +1 -0
  175. package/esm/color/unknown-name.js +16 -0
  176. package/esm/color/unknown-name.js.map +1 -0
  177. package/esm/color/xyz-d50.d.ts +7 -0
  178. package/esm/color/xyz-d50.d.ts.map +1 -0
  179. package/esm/color/xyz-d50.js +15 -0
  180. package/esm/color/xyz-d50.js.map +1 -0
  181. package/esm/color/xyz-d65.d.ts +4 -0
  182. package/esm/color/xyz-d65.d.ts.map +1 -0
  183. package/esm/color/xyz-d65.js +10 -0
  184. package/esm/color/xyz-d65.js.map +1 -0
  185. package/esm/index.d.ts +63 -6
  186. package/esm/index.d.ts.map +1 -0
  187. package/esm/index.js +54 -5
  188. package/esm/index.js.map +1 -0
  189. package/esm/legacy/createColors.d.ts +9 -0
  190. package/esm/legacy/createColors.d.ts.map +1 -0
  191. package/esm/{createColors.js → legacy/createColors.js} +7 -2
  192. package/esm/legacy/createColors.js.map +1 -0
  193. package/esm/legacy/createColorsFromMap.d.ts +9 -0
  194. package/esm/legacy/createColorsFromMap.d.ts.map +1 -0
  195. package/esm/{createColorsFromMap.js → legacy/createColorsFromMap.js} +4 -2
  196. package/esm/legacy/createColorsFromMap.js.map +1 -0
  197. package/esm/legacy/index.d.ts +6 -0
  198. package/esm/legacy/index.js +5 -0
  199. package/esm/legacy/interfaces.d.ts +19 -0
  200. package/esm/legacy/interfaces.d.ts.map +1 -0
  201. package/esm/{rgbHex.d.ts → legacy/rgbHex.d.ts} +1 -4
  202. package/esm/legacy/rgbHex.d.ts.map +1 -0
  203. package/esm/{rgbHex.js → legacy/rgbHex.js} +1 -2
  204. package/esm/legacy/rgbHex.js.map +1 -0
  205. package/esm/legacy/rgbaString.d.ts +4 -0
  206. package/esm/{rgbaString.d.ts.map → legacy/rgbaString.d.ts.map} +1 -1
  207. package/esm/legacy/rgbaString.js +8 -0
  208. package/esm/legacy/rgbaString.js.map +1 -0
  209. package/esm/palette/dark.d.ts +23 -0
  210. package/esm/palette/dark.d.ts.map +1 -0
  211. package/esm/palette/dark.js +54 -0
  212. package/esm/palette/dark.js.map +1 -0
  213. package/esm/palette/harmony.d.ts +56 -0
  214. package/esm/palette/harmony.d.ts.map +1 -0
  215. package/esm/palette/harmony.js +115 -0
  216. package/esm/palette/harmony.js.map +1 -0
  217. package/esm/palette/index.d.ts +5 -0
  218. package/esm/palette/index.js +5 -0
  219. package/esm/palette/semantic.d.ts +53 -0
  220. package/esm/palette/semantic.d.ts.map +1 -0
  221. package/esm/palette/semantic.js +96 -0
  222. package/esm/palette/semantic.js.map +1 -0
  223. package/esm/palette/validate.d.ts +39 -0
  224. package/esm/palette/validate.d.ts.map +1 -0
  225. package/esm/palette/validate.js +56 -0
  226. package/esm/palette/validate.js.map +1 -0
  227. package/esm/scale/brand.d.ts +21 -0
  228. package/esm/scale/brand.d.ts.map +1 -0
  229. package/esm/scale/brand.js +63 -0
  230. package/esm/scale/brand.js.map +1 -0
  231. package/esm/scale/contrast-scale.d.ts +33 -0
  232. package/esm/scale/contrast-scale.d.ts.map +1 -0
  233. package/esm/scale/contrast-scale.js +26 -0
  234. package/esm/scale/contrast-scale.js.map +1 -0
  235. package/esm/scale/gradient.d.ts +38 -0
  236. package/esm/scale/gradient.d.ts.map +1 -0
  237. package/esm/scale/gradient.js +73 -0
  238. package/esm/scale/gradient.js.map +1 -0
  239. package/esm/scale/index.d.ts +6 -0
  240. package/esm/scale/index.js +6 -0
  241. package/esm/scale/scale.d.ts +31 -0
  242. package/esm/scale/scale.d.ts.map +1 -0
  243. package/esm/scale/scale.js +152 -0
  244. package/esm/scale/scale.js.map +1 -0
  245. package/esm/scale/tone.d.ts +25 -0
  246. package/esm/scale/tone.d.ts.map +1 -0
  247. package/esm/scale/tone.js +96 -0
  248. package/esm/scale/tone.js.map +1 -0
  249. package/esm/tokens/css.d.ts +18 -0
  250. package/esm/tokens/css.d.ts.map +1 -0
  251. package/esm/tokens/css.js +23 -0
  252. package/esm/tokens/css.js.map +1 -0
  253. package/esm/tokens/dtcg.d.ts +33 -0
  254. package/esm/tokens/dtcg.d.ts.map +1 -0
  255. package/esm/tokens/dtcg.js +42 -0
  256. package/esm/tokens/dtcg.js.map +1 -0
  257. package/esm/tokens/index.d.ts +5 -0
  258. package/esm/tokens/index.js +4 -0
  259. package/esm/tokens/tailwind.d.ts +19 -0
  260. package/esm/tokens/tailwind.d.ts.map +1 -0
  261. package/esm/tokens/tailwind.js +19 -0
  262. package/esm/tokens/tailwind.js.map +1 -0
  263. package/esm/tokens/tokens.d.ts +11 -0
  264. package/esm/tokens/tokens.d.ts.map +1 -0
  265. package/esm/tokens/tokens.js +77 -0
  266. package/esm/tokens/tokens.js.map +1 -0
  267. package/llms.txt +48 -0
  268. package/package.json +277 -64
  269. package/plugin.json +18 -0
  270. package/schemas/contrast.schema.json +24 -0
  271. package/schemas/convert.schema.json +60 -0
  272. package/schemas/export.schema.json +106 -0
  273. package/schemas/find-contrast.schema.json +51 -0
  274. package/schemas/harmony.schema.json +58 -0
  275. package/schemas/mix.schema.json +72 -0
  276. package/schemas/palette.schema.json +56 -0
  277. package/schemas/scale.schema.json +86 -0
  278. package/skills/color-map/SKILL.md +38 -0
  279. package/src/cli/bin.ts +11 -0
  280. package/src/cli/cli.ts +40 -0
  281. package/src/cli/commands/contrast.ts +36 -0
  282. package/src/cli/commands/convert.ts +37 -0
  283. package/src/cli/commands/export.ts +102 -0
  284. package/src/cli/commands/find-contrast.ts +37 -0
  285. package/src/cli/commands/harmony.ts +30 -0
  286. package/src/cli/commands/mix.ts +29 -0
  287. package/src/cli/commands/palette.ts +66 -0
  288. package/src/cli/commands/scale.ts +75 -0
  289. package/src/cli/index.ts +3 -0
  290. package/src/cli/schema-command.ts +31 -0
  291. package/src/cli/schemas.ts +86 -0
  292. package/src/cli/shared.ts +72 -0
  293. package/src/cli/testing.ts +27 -0
  294. package/src/color/a98-rgb.ts +11 -0
  295. package/src/color/argb.ts +21 -0
  296. package/src/color/calc.ts +84 -0
  297. package/src/color/compare.ts +53 -0
  298. package/src/color/contrast.ts +277 -0
  299. package/src/color/convert.ts +43 -0
  300. package/src/color/display-p3-linear.ts +9 -0
  301. package/src/color/display-p3.ts +9 -0
  302. package/src/color/expr.ts +158 -0
  303. package/src/color/gamut.ts +215 -0
  304. package/src/color/hsl.ts +57 -0
  305. package/src/color/hwb.ts +26 -0
  306. package/src/color/index.ts +43 -0
  307. package/src/color/lab.ts +29 -0
  308. package/src/color/lch.ts +8 -0
  309. package/src/color/math.ts +30 -0
  310. package/src/color/matrices.ts +91 -0
  311. package/src/color/mix.ts +158 -0
  312. package/src/color/named.ts +13 -0
  313. package/src/color/oklab.ts +19 -0
  314. package/src/color/oklch.ts +8 -0
  315. package/src/color/parse.ts +355 -0
  316. package/src/color/polar.ts +17 -0
  317. package/src/color/prophoto-rgb.ts +18 -0
  318. package/src/color/rec2020.ts +11 -0
  319. package/src/color/resolve.ts +87 -0
  320. package/src/color/rgb.ts +20 -0
  321. package/src/color/serialize.ts +96 -0
  322. package/src/color/spaces.ts +42 -0
  323. package/src/color/srgb-linear.ts +9 -0
  324. package/src/color/srgb.ts +9 -0
  325. package/src/color/test-utils.ts +10 -0
  326. package/src/color/transfer.ts +14 -0
  327. package/src/color/types.ts +41 -0
  328. package/src/color/unknown-name.ts +15 -0
  329. package/src/color/xyz-d50.ts +13 -0
  330. package/src/color/xyz-d65.ts +8 -0
  331. package/src/index.ts +37 -0
  332. package/{ts → src/legacy}/createColors.ts +6 -0
  333. package/{ts → src/legacy}/createColorsFromMap.ts +3 -0
  334. package/{ts → src/legacy}/interfaces.ts +4 -0
  335. package/{ts → src/legacy}/rgbaString.ts +1 -0
  336. package/src/palette/dark.ts +55 -0
  337. package/src/palette/harmony.ts +107 -0
  338. package/src/palette/index.ts +18 -0
  339. package/src/palette/semantic.ts +120 -0
  340. package/src/palette/validate.ts +82 -0
  341. package/src/scale/brand.ts +50 -0
  342. package/src/scale/contrast-scale.ts +48 -0
  343. package/src/scale/gradient.ts +91 -0
  344. package/src/scale/index.ts +5 -0
  345. package/src/scale/scale.ts +127 -0
  346. package/src/scale/tone.ts +69 -0
  347. package/src/tokens/css.ts +32 -0
  348. package/src/tokens/dtcg.ts +62 -0
  349. package/src/tokens/index.ts +11 -0
  350. package/src/tokens/tailwind.ts +24 -0
  351. package/src/tokens/tokens.ts +82 -0
  352. package/esm/createColors.d.ts +0 -6
  353. package/esm/createColors.d.ts.map +0 -1
  354. package/esm/createColors.js.map +0 -1
  355. package/esm/createColorsFromMap.d.ts +0 -9
  356. package/esm/createColorsFromMap.d.ts.map +0 -1
  357. package/esm/createColorsFromMap.js.map +0 -1
  358. package/esm/interfaces.d.ts +0 -18
  359. package/esm/interfaces.d.ts.map +0 -1
  360. package/esm/rgbHex.d.ts.map +0 -1
  361. package/esm/rgbHex.js.map +0 -1
  362. package/esm/rgbaString.d.ts +0 -6
  363. package/esm/rgbaString.js +0 -8
  364. package/esm/rgbaString.js.map +0 -1
  365. /package/{ts → src/legacy}/index.ts +0 -0
  366. /package/{ts → src/legacy}/rgbHex.ts +0 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "color-map",
3
+ "version": "2.3.1",
4
+ "description": "Generate WCAG-checked color palettes, scales and design tokens with the color-map CLI",
5
+ "author": {
6
+ "name": "Homa Wong (unional)"
7
+ },
8
+ "homepage": "https://github.com/cyberuni/color-map",
9
+ "repository": "https://github.com/cyberuni/color-map",
10
+ "license": "MIT",
11
+ "keywords": ["color", "palette", "design-system", "contrast", "css"]
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "color-map",
3
+ "version": "2.3.1",
4
+ "description": "Generate WCAG-checked color palettes, scales and design tokens with the color-map CLI",
5
+ "author": {
6
+ "name": "Homa Wong (unional)"
7
+ },
8
+ "homepage": "https://github.com/cyberuni/color-map",
9
+ "repository": "https://github.com/cyberuni/color-map",
10
+ "license": "MIT",
11
+ "keywords": ["color", "palette", "design-system", "contrast", "css"]
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "color-map",
3
+ "version": "2.3.1",
4
+ "description": "Generate WCAG-checked color palettes, scales and design tokens with the color-map CLI",
5
+ "author": {
6
+ "name": "Homa Wong (unional)"
7
+ },
8
+ "homepage": "https://github.com/cyberuni/color-map",
9
+ "repository": "https://github.com/cyberuni/color-map",
10
+ "license": "MIT",
11
+ "keywords": ["color", "palette", "design-system", "contrast", "css"]
12
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
1
+ # color-map
2
+
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 764413e: `llms.txt` now maps the library as well as the commands: each entry point with its exports, the conventions that hold across them, and the `schema` command, which it had left out. The docs site serves the same file at `/color-map/llms.txt`.
8
+
9
+ ## 2.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 7998846: Add contrast to `color-map/color`: `contrast()` (WCAG 2 by default), `meets()` with named levels such as `AA`, `onColor()` for readable text on a background, and `findContrast()` to find a color of a given hue and chroma that reaches a target and report the ratio it achieves. Any `(fg, bg) => number` function, or a `ContrastFn` with thresholds, replaces WCAG 2, for example an APCA function built on colorjs.io. `mix()` now treats the hue of a converted gray as missing in `oklch` and `lch`, so mixing white with blue in `oklch` keeps blue's hue.
14
+ - 0072bf7: Add the color core at `color-map/color`: parse any CSS Color 4 color (hex, named, `rgb()`, `hsl()`, `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()`, `color()`), convert between 15 color spaces, serialize with `toCss()` and `toHex()`, check and fix gamut with `inGamut()` and `toGamut()` (CSS Color 4 mapping or clip), and compare with `deltaEOk()` and `equals()`. Colors are plain `{ colorSpace, components, alpha? }` objects with `null` for `none`. `fromArgb()` and `toArgb()` convert to and from Material Color Utilities' integer colors. Each space is its own module, so importing one space costs only that space. The existing `createColors`, `createColorsFromMap`, `rgbHex` and `rgbaString` are unchanged.
15
+ - bffd600: Add `createGradient()` to `color-map/scale`: it returns a number of colors along a gradient through color stops, the way a CSS gradient blends them. A stop is `{ color, at? }` or a bare color; stops without a position spread evenly; `in` and `hue` work as they do in `mix()`, with `oklab` by default; each stop's color carries its own alpha. `createColorsFromMap` is now deprecated in favor of `createGradient`, with no change in behavior.
16
+ - aba59da: Add the `color-map` command and an agent skill to the package. `npx color-map` runs `convert`, `mix`, `contrast`, `find-contrast`, `scale`, `palette`, `harmony`, `export` and `schema`; output is TOON by default (`--format json` for JSON), errors are coded, and WCAG 2 is the contrast measure. The package also ships JSON Schemas for every command's options (`color-map/schemas/*`), an `llms.txt`, and a `color-map` skill as a plugin for Claude Code, Cursor, Codex and Copilot CLI. The package still has no runtime dependencies, and the library entry points do not load the command.
17
+ - 01f8f8a: Add `mix()` for interpolating colors the way CSS does, and `parseExpr()` and `resolve()` for CSS Color 5 values: `color-mix()`, relative colors with a `calc()` subset, `light-dark()`, `contrast-color()`, `currentcolor` and system colors. They are exported from `color-map/color`.
18
+ - 887187f: Add `color-map/palette`: `harmony()` (complementary, split, analogous, triadic and tetradic, rotated in OKLCH by default), `harmonize()` (Material's rule: move a hue half the way toward another, at most 15°), `inverse()`, `darkVariant()` (`mirror`, `tone-swap` or `lightness-invert`), `semanticPalette()` (primary, status, surface and outline roles, each pair recording its contrast) and `validate()` (failing pairs, scales whose lightness is not steady, and out-of-gamut colors). Tone gaps of 50 give about 4.5 on WCAG 2, and 4.48 at the worst pair.
19
+ - b213db4: Add `color-map/scale`: `createScale()` with the `tailwind-11`, `radix-12`, `tone-13` and `even` presets (or your own lightness, chroma and hue-shift curves), `createContrastScale()` to pick each step by target contrast, `scaleFromBrand()` for a 12-step scale with your brand color exactly at step 9, and `tonalPalette()` for L* tones, where tones 40 apart reach contrast 3. `mix()` now also treats the hue of a converted gray as missing in `hsl` and `hwb`, and converting white to `hsl` gives saturation 0.
20
+ - be3ba42: Add `color-map/tokens`: `toDtcg()` (a DTCG 2025.10 token file with a hex fallback; `none` components print as `"none"`), `toCssVariables()` (custom properties in one rule) and `toTailwindTheme()` (a Tailwind v4 `@theme` block in oklch). They take a color, a CSS string, an array (a scale; 11 colors get the keys 50 to 950), a nested object, or a `semanticPalette()` result.
21
+ - 0ccc6f7: Add narrow forms of the converting helpers to `color-map/color`: `createToHex`, `createInGamut`, `createToGamut`, `createDeltaEOk`, `createEquals`, `createMix`, `createContrast`, `createMeets`, `createOnColor` and `createFindContrast`. Each takes the spaces your colors are in, as `createConverter` does, and returns the helper over just those, so a bundle no longer carries all 15 spaces. Each adds the spaces it works in itself; `createToGamut`, for example, adds `srgb`, `oklch` and `oklab`. The narrow helpers take color objects rather than CSS strings, so they do not carry `parse`. `toHex` over every space is about 3 kB gzip; `createToHex(oklch)` is about 1.3 kB. The existing helpers are unchanged.
22
+ - 42ff99d: `color-map` now re-exports `color-map/color`, `color-map/scale`, `color-map/palette` and `color-map/tokens`, so `import { parse, toCss } from 'color-map'` works. With a bundler, this costs nothing extra.
23
+
24
+ Add `color-map/legacy` with `createColors`, `createColorsFromMap`, `rgbHex`, `rgbaString` and their types. The root still exports these names, unchanged, but marks them deprecated: 3.0 removes them from the root, so import them from `color-map/legacy`.
25
+
26
+ ### Patch Changes
27
+
28
+ - 9b46fea: Add an Acknowledgements section to the README.
29
+ - 9930c90: Make `parse`, `toGamut` and `mix` faster, with the same results and no API change. `parse` reads hex and the plain functional forms by char code (about 2.4 times faster, on the repository benchmark), `toGamut` into `srgb` searches in linear sRGB (about 4.6 times), and `mix` skips the `none` and powerless-hue work when no component is `none` (about 3 times). Anything the fast parse path does not take still goes through the previous parser, so every accepted form and error message is unchanged. The gzip size of the convert-from-a-string scenario grows by about 0.9 kB.
30
+ - 8287110: Speed up color conversion, `toGamut`, `contrast`, `mix` and the scale and palette builders (`semanticPalette` runs about 1.8 times as fast), and shrink every entry point's gzip size slightly. Every result is unchanged, to the last bit.
31
+ - 602a460: Fix names such as `constructor`, `__proto__` and `toString` reaching `Object.prototype` in `parse`, `parseExpr`, `meets`, `harmony`, `createScale` and `toDtcg`; they are now unknown names like any other, and `toDtcg` returns groups without a prototype. Make `toCss` about 2.7 times faster with an exact rounding fast path; its output is unchanged.
32
+ - 96f4464: Include `CHANGELOG.md` in the published package.
33
+ - 85506ca: An unknown preset, scheme, mode, strategy, contrast algorithm or hue method now throws `color-map: unknown <thing> "<value>"; use one of ...` instead of a raw `TypeError` (`createScale({ seed, steps: 'nope' })`) or a silent fallback (`mode`, harmony `space`). An unknown color space also lists the valid ones, and `meets` words its unknown-level error the same way.
34
+
35
+ Entries from 2.2.0 and earlier were produced by semantic-release, which was
36
+ configured without the changelog plugin — 2.1.0 and 2.2.0 exist only as GitHub
37
+ Releases and are absent below. Everything from the next release on is written
38
+ here by changesets.
39
+
40
+ ## [2.0.6](https://github.com/unional/color-map/compare/v2.0.5...v2.0.6) (2022-10-03)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * re-release again ([cf9ba4c](https://github.com/unional/color-map/commit/cf9ba4c75af52f5803b53a30cb0e003c201595f2))
46
+
47
+ ## [2.0.5](https://github.com/unional/color-map/compare/v2.0.4...v2.0.5) (2022-10-03)
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * re-release ([0742296](https://github.com/unional/color-map/commit/07422964537f9a0564149a353ecfe3911c01eb0a))
53
+
54
+ ## [2.0.4](https://github.com/unional/color-map/compare/v2.0.3...v2.0.4) (2022-10-03)
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * cjs package.json ([3b85801](https://github.com/unional/color-map/commit/3b85801902c2b555d9fa9f4bb98a8da23bcd25c6))
60
+
61
+ ## [2.0.3](https://github.com/unional/color-map/compare/v2.0.2...v2.0.3) (2022-06-13)
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * add main field ([3acec72](https://github.com/unional/color-map/commit/3acec726b6a9bfe82cbe6553dec6ba53b659facb))
67
+
68
+ ## [2.0.2](https://github.com/unional/color-map/compare/v2.0.1...v2.0.2) (2022-06-13)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * add exports.require for CJS ([b36cde8](https://github.com/unional/color-map/commit/b36cde8cd75e4a00ef572b0b6a4badb2109a1a84))
74
+
75
+ ## [2.0.1](https://github.com/unional/color-map/compare/v2.0.0...v2.0.1) (2022-06-13)
76
+
77
+
78
+ ### Bug Fixes
79
+
80
+ * use NodeNext module resolution ([#128](https://github.com/unional/color-map/issues/128)) ([fdfc5cc](https://github.com/unional/color-map/commit/fdfc5ccfcc0025d1b2c3ccbe0138c3b491fc7037))
81
+
82
+ # [2.0.0](https://github.com/unional/color-map/compare/v1.1.4...v2.0.0) (2022-06-13)
83
+
84
+
85
+ ### Bug Fixes
86
+
87
+ * remove spec files from dist ([#126](https://github.com/unional/color-map/issues/126)) ([e1ad859](https://github.com/unional/color-map/commit/e1ad859a38c91a450cd23f1b126ba9992de87c62))
88
+
89
+
90
+ * fix!: export as ESM (#127) ([ae16eaa](https://github.com/unional/color-map/commit/ae16eaa83629a5248143eee8a895a0edb15240c1)), closes [#127](https://github.com/unional/color-map/issues/127)
91
+
92
+
93
+ ### BREAKING CHANGES
94
+
95
+ * export with only ESM
96
+
97
+ This is more of a testing release, to see what are the behavior of ESM:
98
+
99
+ - how it behaves when exporting ESM using esnext
100
+ - how it behaves with only ESM
package/README.md CHANGED
@@ -14,10 +14,25 @@ Color map generator with no dependency.
14
14
 
15
15
  Inspired from [`colormap`](https://github.com/bpostlethwaite/colormap).
16
16
 
17
- ## `createColors(from, to, shades, alpha?)`
17
+ ## Library
18
18
 
19
19
  ```ts
20
- import { createColors } from 'color-map'
20
+ import { parse, toCss, convert, semanticPalette, toTailwindTheme } from 'color-map'
21
+
22
+ toCss(convert(parse('#3b82f6'), 'oklch')) // oklch(0.62308 0.18801 259.81453)
23
+ toTailwindTheme(semanticPalette({ brand: '#3b82f6', mode: 'light' })) // an @theme { ... } block
24
+ ```
25
+
26
+ `color-map` re-exports the subpaths `color-map/color`, `color-map/scale`, `color-map/palette` and `color-map/tokens`. With a bundler, the root costs the same bytes as a subpath. Code that runs without a bundler can import a subpath to load less. See the [library docs](https://cyberuni.github.io/color-map/library/) for the full API.
27
+
28
+ ## Legacy API
29
+
30
+ The original API lives in `color-map/legacy`. The root `color-map` still exports it in 2.x, marked deprecated, and stops in 3.0.
31
+
32
+ ### `createColors(from, to, shades, alpha?)`
33
+
34
+ ```ts
35
+ import { createColors } from 'color-map/legacy'
21
36
 
22
37
  // creates array of [r,g,b,a]
23
38
  const rgbaRange = createColors([0, 0, 255], [0, 255, 128], 72, [0, 1])
@@ -26,34 +41,80 @@ const rgbaRange = createColors([0, 0, 255], [0, 255, 128], 72, [0, 1])
26
41
  const rgbRange = createColors([0, 0, 255], [0, 255, 128], 72)
27
42
  ```
28
43
 
29
- ## `rgbHex(rgb)`
44
+ ### `rgbHex(rgb)`
30
45
 
31
46
  ```ts
32
- import { rgbHex } from 'color-map'
47
+ import { rgbHex } from 'color-map/legacy'
33
48
 
34
49
  rgbHex([0, 128, 255]) // '#0080ff'
35
50
  rgbHex([0, 128, 255, 0.3]) // '#0080ff'
36
51
  ```
37
52
 
38
- ## `rgbaString(rgba)`
53
+ ### `rgbaString(rgba)`
39
54
 
40
55
  ```ts
41
- import { rgbaString } from 'color-map'
56
+ import { rgbaString } from 'color-map/legacy'
42
57
 
43
58
  rgbaString([0, 128, 255, 0.2]) // 'rgba(0,128,255,0.2)`
44
59
 
45
60
  ```
46
61
 
47
- ## `createColorsFromMap(colormap, shades, alpha?)`
62
+ ### `createColorsFromMap(colormap, shades, alpha?)`
48
63
 
49
64
  ```ts
50
- import { createColorsFromMap, ColorMap } from 'color-map'
65
+ import { createColorsFromMap, ColorMap } from 'color-map/legacy'
51
66
 
52
67
  const summer: ColorMap = [{ index: 0, rgb: [0,128,102] }, { index: 1, rgb: [255,255,102] }]
53
68
 
54
69
  const colors = createColorsFromMap(summer, 60)
55
70
  ```
56
71
 
72
+ `createColorsFromMap` is deprecated. Use `createGradient` instead:
73
+
74
+ ```ts
75
+ import { createGradient } from 'color-map'
76
+
77
+ const colors = createGradient(['rgb(0 128 102)', 'rgb(255 255 102)'], 60, { in: 'srgb' })
78
+ ```
79
+
80
+ It returns color objects with channels from 0 to 1, not whole numbers. See [Gradients](https://cyberuni.github.io/color-map/library/#gradients) for the full recipe.
81
+
82
+ ## The `color-map` command
83
+
84
+ The package ships a command for agents, with no extra install and no runtime dependency:
85
+
86
+ ```sh
87
+ npx color-map palette '#3b82f6'
88
+ ```
89
+
90
+ Output is [TOON](https://github.com/toon-format/toon) by default, with `--format json` for JSON. It follows the [AXI](https://github.com/kunchenguid/axi) principles: essential fields by default and `--full` for the rest, precomputed contrast ratios, explicit empty results, coded errors with exit codes (1 failed, 2 wrong call), no prompts, and a suggested next command after each result.
91
+
92
+ | Command | What it does |
93
+ | --- | --- |
94
+ | `convert <color> --to <space>` | convert to any CSS color space, optionally gamut-mapped |
95
+ | `mix <a> <b>` | mix as `color-mix()` does |
96
+ | `contrast <fg> <bg>` | WCAG 2 ratio with AA and AAA verdicts |
97
+ | `find-contrast <bg> --target 4.5` | find a color that reaches a ratio |
98
+ | `scale <seed>` | a Tailwind, Radix, tone or even scale, a brand scale, or a contrast scale |
99
+ | `palette <brand>` | a semantic palette; every text pair carries its ratio |
100
+ | `harmony <color>` | complementary, split, analogous, triadic or tetradic colors |
101
+ | `export [color]` | CSS variables, DTCG JSON or a Tailwind v4 theme |
102
+ | `schema [command]` | the JSON Schema of a command's options |
103
+
104
+ Contrast is WCAG 2.
105
+
106
+ ### For agents
107
+
108
+ - JSON Schemas for every command's arguments and options ship in `schemas/` (for example `color-map/schemas/scale.schema.json`) and print with `color-map schema <command>`.
109
+ - The `color-map` agent skill ships in this package as a plugin for Claude Code, Cursor, Codex and Copilot CLI (`plugin.json`, `skills/color-map`).
110
+ - [`llms.txt`](./llms.txt) maps the commands.
111
+
112
+ The command is a separate bundle (`bin/color-map.js`) that inlines its parser. No library entry point loads it, so importing `color-map` costs nothing for it.
113
+
114
+ ## Acknowledgements
115
+
116
+ `color-map` follows CSS Color 4 and 5 (W3C), uses [Björn Ottosson's OKLab](https://bottosson.github.io/posts/oklab/), and writes [Design Tokens](https://www.designtokens.org/) color values. Its scales and palettes learn from [Radix Colors](https://www.radix-ui.com/colors), [Material Design 3](https://m3.material.io/styles/color/system/overview) and [Tailwind CSS](https://tailwindcss.com/). It started from [`colormap`](https://github.com/bpostlethwaite/colormap). The [Compare page](https://cyberuni.github.io/color-map/compare/) measures it against culori, Color.js, chroma-js, @texel/color, @colordx/core, lightningcss and colord. No third-party source code is bundled. The [Credits page](https://cyberuni.github.io/color-map/credits/) says what each one contributed and under which license.
117
+
57
118
  ## Contribute
58
119
 
59
120
  ```sh
@@ -71,6 +132,8 @@ git push
71
132
  # create PR
72
133
  ```
73
134
 
135
+ `npm run size` checks the gzip size of each entry point against its budget. `npm run build && npm run bench` times the same operations in color-map, culori and colorjs.io and prints ops/sec for each; `--filter <name>` runs only the matching operations.
136
+
74
137
  [codecov-image]: https://codecov.io/gh/cyberuni/color-map/branch/main/graph/badge.svg
75
138
  [codecov-url]: https://codecov.io/gh/cyberuni/color-map
76
139
  [downloads-image]: https://img.shields.io/npm/dm/color-map.svg?style=flat