color-map 2.1.0 → 2.3.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 (412) 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 +94 -0
  5. package/README.md +71 -11
  6. package/bin/cli-CNBftDBE.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 +27 -5
  28. package/cjs/index.d.ts.map +1 -0
  29. package/cjs/index.js +89 -20
  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/package.json +1 -1
  39. package/cjs/palette/index.d.ts +3 -0
  40. package/cjs/palette/index.js +8 -0
  41. package/cjs/palette-DyFV_KoJ.js +332 -0
  42. package/cjs/palette-DyFV_KoJ.js.map +1 -0
  43. package/cjs/parse-8mt2OMKf.js +1508 -0
  44. package/cjs/parse-8mt2OMKf.js.map +1 -0
  45. package/cjs/scale/index.d.ts +2 -0
  46. package/cjs/scale/index.js +11 -0
  47. package/cjs/scale-Cq9pXrc1.js +318 -0
  48. package/cjs/scale-Cq9pXrc1.js.map +1 -0
  49. package/cjs/semantic-CrEIo8tS.d.ts +52 -0
  50. package/cjs/semantic-CrEIo8tS.d.ts.map +1 -0
  51. package/cjs/serialize-C69DAmoE.d.ts +25 -0
  52. package/cjs/serialize-C69DAmoE.d.ts.map +1 -0
  53. package/cjs/serialize-Ci2X0cPN.js +103 -0
  54. package/cjs/serialize-Ci2X0cPN.js.map +1 -0
  55. package/cjs/tokens/index.d.ts +2 -0
  56. package/cjs/tokens/index.js +6 -0
  57. package/cjs/tokens-CzXxaMgM.js +168 -0
  58. package/cjs/tokens-CzXxaMgM.js.map +1 -0
  59. package/cjs/tone-BAhu-QzQ.js +118 -0
  60. package/cjs/tone-BAhu-QzQ.js.map +1 -0
  61. package/dist/color-map.es5.js +1 -1
  62. package/dist/color-map.es5.js.map +1 -1
  63. package/esm/color/a98-rgb.d.ts +7 -0
  64. package/esm/color/a98-rgb.d.ts.map +1 -0
  65. package/esm/color/a98-rgb.js +13 -0
  66. package/esm/color/a98-rgb.js.map +1 -0
  67. package/esm/color/argb.d.ts +6 -0
  68. package/esm/color/argb.d.ts.map +1 -0
  69. package/esm/color/argb.js +25 -0
  70. package/esm/color/argb.js.map +1 -0
  71. package/esm/color/calc.js +82 -0
  72. package/esm/color/calc.js.map +1 -0
  73. package/esm/color/compare.d.ts +20 -0
  74. package/esm/color/compare.d.ts.map +1 -0
  75. package/esm/color/compare.js +46 -0
  76. package/esm/color/compare.js.map +1 -0
  77. package/esm/color/contrast.d.ts +107 -0
  78. package/esm/color/contrast.d.ts.map +1 -0
  79. package/esm/color/contrast.js +242 -0
  80. package/esm/color/contrast.js.map +1 -0
  81. package/esm/color/convert.d.ts +9 -0
  82. package/esm/color/convert.d.ts.map +1 -0
  83. package/esm/color/convert.js +45 -0
  84. package/esm/color/convert.js.map +1 -0
  85. package/esm/color/display-p3-linear.d.ts +7 -0
  86. package/esm/color/display-p3-linear.d.ts.map +1 -0
  87. package/esm/color/display-p3-linear.js +12 -0
  88. package/esm/color/display-p3-linear.js.map +1 -0
  89. package/esm/color/display-p3.d.ts +7 -0
  90. package/esm/color/display-p3.d.ts.map +1 -0
  91. package/esm/color/display-p3.js +12 -0
  92. package/esm/color/display-p3.js.map +1 -0
  93. package/esm/color/expr.d.ts +43 -0
  94. package/esm/color/expr.d.ts.map +1 -0
  95. package/esm/color/expr.js +160 -0
  96. package/esm/color/expr.js.map +1 -0
  97. package/esm/color/gamut.d.ts +31 -0
  98. package/esm/color/gamut.d.ts.map +1 -0
  99. package/esm/color/gamut.js +210 -0
  100. package/esm/color/gamut.js.map +1 -0
  101. package/esm/color/hsl.d.ts +7 -0
  102. package/esm/color/hsl.d.ts.map +1 -0
  103. package/esm/color/hsl.js +67 -0
  104. package/esm/color/hsl.js.map +1 -0
  105. package/esm/color/hwb.d.ts +7 -0
  106. package/esm/color/hwb.d.ts.map +1 -0
  107. package/esm/color/hwb.js +40 -0
  108. package/esm/color/hwb.js.map +1 -0
  109. package/esm/color/index.d.ts +28 -0
  110. package/esm/color/index.js +27 -0
  111. package/esm/color/lab.d.ts +7 -0
  112. package/esm/color/lab.d.ts.map +1 -0
  113. package/esm/color/lab.js +33 -0
  114. package/esm/color/lab.js.map +1 -0
  115. package/esm/color/lch.d.ts +7 -0
  116. package/esm/color/lch.d.ts.map +1 -0
  117. package/esm/color/lch.js +11 -0
  118. package/esm/color/lch.js.map +1 -0
  119. package/esm/color/math.js +32 -0
  120. package/esm/color/math.js.map +1 -0
  121. package/esm/color/matrices.js +180 -0
  122. package/esm/color/matrices.js.map +1 -0
  123. package/esm/color/mix.d.ts +30 -0
  124. package/esm/color/mix.d.ts.map +1 -0
  125. package/esm/color/mix.js +152 -0
  126. package/esm/color/mix.js.map +1 -0
  127. package/esm/color/named.js +11 -0
  128. package/esm/color/named.js.map +1 -0
  129. package/esm/color/oklab.d.ts +7 -0
  130. package/esm/color/oklab.d.ts.map +1 -0
  131. package/esm/color/oklab.js +21 -0
  132. package/esm/color/oklab.js.map +1 -0
  133. package/esm/color/oklch.d.ts +7 -0
  134. package/esm/color/oklch.d.ts.map +1 -0
  135. package/esm/color/oklch.js +11 -0
  136. package/esm/color/oklch.js.map +1 -0
  137. package/esm/color/parse.d.ts +9 -0
  138. package/esm/color/parse.d.ts.map +1 -0
  139. package/esm/color/parse.js +452 -0
  140. package/esm/color/parse.js.map +1 -0
  141. package/esm/color/polar.js +27 -0
  142. package/esm/color/polar.js.map +1 -0
  143. package/esm/color/prophoto-rgb.d.ts +7 -0
  144. package/esm/color/prophoto-rgb.d.ts.map +1 -0
  145. package/esm/color/prophoto-rgb.js +18 -0
  146. package/esm/color/prophoto-rgb.js.map +1 -0
  147. package/esm/color/rec2020.d.ts +7 -0
  148. package/esm/color/rec2020.d.ts.map +1 -0
  149. package/esm/color/rec2020.js +13 -0
  150. package/esm/color/rec2020.js.map +1 -0
  151. package/esm/color/resolve.d.ts +18 -0
  152. package/esm/color/resolve.d.ts.map +1 -0
  153. package/esm/color/resolve.js +98 -0
  154. package/esm/color/resolve.js.map +1 -0
  155. package/esm/color/rgb.js +20 -0
  156. package/esm/color/rgb.js.map +1 -0
  157. package/esm/color/serialize.d.ts +24 -0
  158. package/esm/color/serialize.d.ts.map +1 -0
  159. package/esm/color/serialize.js +88 -0
  160. package/esm/color/serialize.js.map +1 -0
  161. package/esm/color/spaces.d.ts +6 -0
  162. package/esm/color/spaces.d.ts.map +1 -0
  163. package/esm/color/spaces.js +42 -0
  164. package/esm/color/spaces.js.map +1 -0
  165. package/esm/color/srgb-linear.d.ts +7 -0
  166. package/esm/color/srgb-linear.d.ts.map +1 -0
  167. package/esm/color/srgb-linear.js +12 -0
  168. package/esm/color/srgb-linear.js.map +1 -0
  169. package/esm/color/srgb.d.ts +7 -0
  170. package/esm/color/srgb.d.ts.map +1 -0
  171. package/esm/color/srgb.js +12 -0
  172. package/esm/color/srgb.js.map +1 -0
  173. package/esm/color/transfer.js +11 -0
  174. package/esm/color/transfer.js.map +1 -0
  175. package/esm/color/types.d.ts +23 -0
  176. package/esm/color/types.d.ts.map +1 -0
  177. package/esm/color/unknown-name.js +16 -0
  178. package/esm/color/unknown-name.js.map +1 -0
  179. package/esm/color/xyz-d50.d.ts +7 -0
  180. package/esm/color/xyz-d50.d.ts.map +1 -0
  181. package/esm/color/xyz-d50.js +15 -0
  182. package/esm/color/xyz-d50.js.map +1 -0
  183. package/esm/color/xyz-d65.d.ts +4 -0
  184. package/esm/color/xyz-d65.d.ts.map +1 -0
  185. package/esm/color/xyz-d65.js +10 -0
  186. package/esm/color/xyz-d65.js.map +1 -0
  187. package/esm/index.d.ts +63 -5
  188. package/esm/index.d.ts.map +1 -0
  189. package/esm/index.js +53 -4
  190. package/esm/index.js.map +1 -1
  191. package/esm/legacy/createColors.d.ts +9 -0
  192. package/esm/legacy/createColors.d.ts.map +1 -0
  193. package/esm/legacy/createColors.js +32 -0
  194. package/esm/legacy/createColors.js.map +1 -0
  195. package/esm/legacy/createColorsFromMap.d.ts +9 -0
  196. package/esm/legacy/createColorsFromMap.d.ts.map +1 -0
  197. package/esm/legacy/createColorsFromMap.js +24 -0
  198. package/esm/legacy/createColorsFromMap.js.map +1 -0
  199. package/esm/legacy/index.d.ts +6 -0
  200. package/esm/legacy/index.js +5 -0
  201. package/esm/legacy/interfaces.d.ts +19 -0
  202. package/esm/legacy/interfaces.d.ts.map +1 -0
  203. package/esm/{rgbHex.d.ts → legacy/rgbHex.d.ts} +2 -1
  204. package/esm/legacy/rgbHex.d.ts.map +1 -0
  205. package/esm/legacy/rgbHex.js +17 -0
  206. package/esm/legacy/rgbHex.js.map +1 -0
  207. package/esm/legacy/rgbaString.d.ts +4 -0
  208. package/esm/legacy/rgbaString.d.ts.map +1 -0
  209. package/esm/legacy/rgbaString.js +8 -0
  210. package/esm/legacy/rgbaString.js.map +1 -0
  211. package/esm/palette/dark.d.ts +23 -0
  212. package/esm/palette/dark.d.ts.map +1 -0
  213. package/esm/palette/dark.js +54 -0
  214. package/esm/palette/dark.js.map +1 -0
  215. package/esm/palette/harmony.d.ts +56 -0
  216. package/esm/palette/harmony.d.ts.map +1 -0
  217. package/esm/palette/harmony.js +115 -0
  218. package/esm/palette/harmony.js.map +1 -0
  219. package/esm/palette/index.d.ts +5 -0
  220. package/esm/palette/index.js +5 -0
  221. package/esm/palette/semantic.d.ts +53 -0
  222. package/esm/palette/semantic.d.ts.map +1 -0
  223. package/esm/palette/semantic.js +96 -0
  224. package/esm/palette/semantic.js.map +1 -0
  225. package/esm/palette/validate.d.ts +39 -0
  226. package/esm/palette/validate.d.ts.map +1 -0
  227. package/esm/palette/validate.js +56 -0
  228. package/esm/palette/validate.js.map +1 -0
  229. package/esm/scale/brand.d.ts +21 -0
  230. package/esm/scale/brand.d.ts.map +1 -0
  231. package/esm/scale/brand.js +63 -0
  232. package/esm/scale/brand.js.map +1 -0
  233. package/esm/scale/contrast-scale.d.ts +33 -0
  234. package/esm/scale/contrast-scale.d.ts.map +1 -0
  235. package/esm/scale/contrast-scale.js +26 -0
  236. package/esm/scale/contrast-scale.js.map +1 -0
  237. package/esm/scale/gradient.d.ts +38 -0
  238. package/esm/scale/gradient.d.ts.map +1 -0
  239. package/esm/scale/gradient.js +73 -0
  240. package/esm/scale/gradient.js.map +1 -0
  241. package/esm/scale/index.d.ts +6 -0
  242. package/esm/scale/index.js +6 -0
  243. package/esm/scale/scale.d.ts +31 -0
  244. package/esm/scale/scale.d.ts.map +1 -0
  245. package/esm/scale/scale.js +152 -0
  246. package/esm/scale/scale.js.map +1 -0
  247. package/esm/scale/tone.d.ts +25 -0
  248. package/esm/scale/tone.d.ts.map +1 -0
  249. package/esm/scale/tone.js +96 -0
  250. package/esm/scale/tone.js.map +1 -0
  251. package/esm/tokens/css.d.ts +18 -0
  252. package/esm/tokens/css.d.ts.map +1 -0
  253. package/esm/tokens/css.js +23 -0
  254. package/esm/tokens/css.js.map +1 -0
  255. package/esm/tokens/dtcg.d.ts +33 -0
  256. package/esm/tokens/dtcg.d.ts.map +1 -0
  257. package/esm/tokens/dtcg.js +42 -0
  258. package/esm/tokens/dtcg.js.map +1 -0
  259. package/esm/tokens/index.d.ts +5 -0
  260. package/esm/tokens/index.js +4 -0
  261. package/esm/tokens/tailwind.d.ts +19 -0
  262. package/esm/tokens/tailwind.d.ts.map +1 -0
  263. package/esm/tokens/tailwind.js +19 -0
  264. package/esm/tokens/tailwind.js.map +1 -0
  265. package/esm/tokens/tokens.d.ts +11 -0
  266. package/esm/tokens/tokens.d.ts.map +1 -0
  267. package/esm/tokens/tokens.js +77 -0
  268. package/esm/tokens/tokens.js.map +1 -0
  269. package/llms.txt +29 -0
  270. package/package.json +240 -56
  271. package/plugin.json +18 -0
  272. package/schemas/contrast.schema.json +24 -0
  273. package/schemas/convert.schema.json +60 -0
  274. package/schemas/export.schema.json +106 -0
  275. package/schemas/find-contrast.schema.json +51 -0
  276. package/schemas/harmony.schema.json +58 -0
  277. package/schemas/mix.schema.json +72 -0
  278. package/schemas/palette.schema.json +56 -0
  279. package/schemas/scale.schema.json +86 -0
  280. package/skills/color-map/SKILL.md +38 -0
  281. package/src/cli/bin.ts +11 -0
  282. package/src/cli/cli.ts +40 -0
  283. package/src/cli/commands/contrast.ts +36 -0
  284. package/src/cli/commands/convert.ts +37 -0
  285. package/src/cli/commands/export.ts +102 -0
  286. package/src/cli/commands/find-contrast.ts +37 -0
  287. package/src/cli/commands/harmony.ts +30 -0
  288. package/src/cli/commands/mix.ts +29 -0
  289. package/src/cli/commands/palette.ts +66 -0
  290. package/src/cli/commands/scale.ts +75 -0
  291. package/src/cli/index.ts +2 -0
  292. package/src/cli/schema-command.ts +31 -0
  293. package/src/cli/schemas.ts +86 -0
  294. package/src/cli/shared.ts +72 -0
  295. package/src/cli/testing.ts +27 -0
  296. package/src/color/a98-rgb.ts +11 -0
  297. package/src/color/argb.ts +21 -0
  298. package/src/color/calc.ts +84 -0
  299. package/src/color/compare.ts +53 -0
  300. package/src/color/contrast.ts +277 -0
  301. package/src/color/convert.ts +43 -0
  302. package/src/color/display-p3-linear.ts +9 -0
  303. package/src/color/display-p3.ts +9 -0
  304. package/src/color/expr.ts +158 -0
  305. package/src/color/gamut.ts +215 -0
  306. package/src/color/hsl.ts +57 -0
  307. package/src/color/hwb.ts +26 -0
  308. package/src/color/index.ts +43 -0
  309. package/src/color/lab.ts +29 -0
  310. package/src/color/lch.ts +8 -0
  311. package/src/color/math.ts +30 -0
  312. package/src/color/matrices.ts +91 -0
  313. package/src/color/mix.ts +158 -0
  314. package/src/color/named.ts +13 -0
  315. package/src/color/oklab.ts +19 -0
  316. package/src/color/oklch.ts +8 -0
  317. package/src/color/parse.ts +355 -0
  318. package/src/color/polar.ts +17 -0
  319. package/src/color/prophoto-rgb.ts +18 -0
  320. package/src/color/rec2020.ts +11 -0
  321. package/src/color/resolve.ts +87 -0
  322. package/src/color/rgb.ts +20 -0
  323. package/src/color/serialize.ts +96 -0
  324. package/src/color/spaces.ts +42 -0
  325. package/src/color/srgb-linear.ts +9 -0
  326. package/src/color/srgb.ts +9 -0
  327. package/src/color/test-utils.ts +10 -0
  328. package/src/color/transfer.ts +14 -0
  329. package/src/color/types.ts +41 -0
  330. package/src/color/unknown-name.ts +15 -0
  331. package/src/color/xyz-d50.ts +13 -0
  332. package/src/color/xyz-d65.ts +8 -0
  333. package/src/index.ts +37 -0
  334. package/src/legacy/createColors.ts +36 -0
  335. package/src/legacy/createColorsFromMap.ts +29 -0
  336. package/src/legacy/interfaces.ts +19 -0
  337. package/{ts → src/legacy}/rgbHex.ts +7 -7
  338. package/src/legacy/rgbaString.ts +6 -0
  339. package/src/palette/dark.ts +55 -0
  340. package/src/palette/harmony.ts +107 -0
  341. package/src/palette/index.ts +18 -0
  342. package/src/palette/semantic.ts +120 -0
  343. package/src/palette/validate.ts +82 -0
  344. package/src/scale/brand.ts +50 -0
  345. package/src/scale/contrast-scale.ts +48 -0
  346. package/src/scale/gradient.ts +91 -0
  347. package/src/scale/index.ts +5 -0
  348. package/src/scale/scale.ts +127 -0
  349. package/src/scale/tone.ts +69 -0
  350. package/src/tokens/css.ts +32 -0
  351. package/src/tokens/dtcg.ts +62 -0
  352. package/src/tokens/index.ts +11 -0
  353. package/src/tokens/tailwind.ts +24 -0
  354. package/src/tokens/tokens.ts +82 -0
  355. package/cjs/createColors.d.ts +0 -2
  356. package/cjs/createColors.js +0 -40
  357. package/cjs/createColors.js.map +0 -1
  358. package/cjs/createColors.spec.d.ts +0 -1
  359. package/cjs/createColors.spec.js +0 -176
  360. package/cjs/createColors.spec.js.map +0 -1
  361. package/cjs/createColorsFromMap.d.ts +0 -5
  362. package/cjs/createColorsFromMap.js +0 -25
  363. package/cjs/createColorsFromMap.js.map +0 -1
  364. package/cjs/createColorsFromMap.spec.d.ts +0 -1
  365. package/cjs/createColorsFromMap.spec.js +0 -11
  366. package/cjs/createColorsFromMap.spec.js.map +0 -1
  367. package/cjs/interfaces.d.ts +0 -14
  368. package/cjs/interfaces.js +0 -3
  369. package/cjs/interfaces.js.map +0 -1
  370. package/cjs/rgbHex.d.ts +0 -6
  371. package/cjs/rgbHex.js +0 -19
  372. package/cjs/rgbHex.js.map +0 -1
  373. package/cjs/rgbHex.spec.d.ts +0 -1
  374. package/cjs/rgbHex.spec.js +0 -16
  375. package/cjs/rgbHex.spec.js.map +0 -1
  376. package/cjs/rgbaString.d.ts +0 -2
  377. package/cjs/rgbaString.js +0 -7
  378. package/cjs/rgbaString.js.map +0 -1
  379. package/cjs/rgbaString.spec.d.ts +0 -1
  380. package/cjs/rgbaString.spec.js +0 -10
  381. package/cjs/rgbaString.spec.js.map +0 -1
  382. package/esm/createColors.d.ts +0 -2
  383. package/esm/createColors.js +0 -27
  384. package/esm/createColors.js.map +0 -1
  385. package/esm/createColors.spec.d.ts +0 -1
  386. package/esm/createColors.spec.js +0 -171
  387. package/esm/createColors.spec.js.map +0 -1
  388. package/esm/createColorsFromMap.d.ts +0 -5
  389. package/esm/createColorsFromMap.js +0 -22
  390. package/esm/createColorsFromMap.js.map +0 -1
  391. package/esm/createColorsFromMap.spec.d.ts +0 -1
  392. package/esm/createColorsFromMap.spec.js +0 -9
  393. package/esm/createColorsFromMap.spec.js.map +0 -1
  394. package/esm/interfaces.d.ts +0 -14
  395. package/esm/interfaces.js +0 -2
  396. package/esm/interfaces.js.map +0 -1
  397. package/esm/rgbHex.js +0 -16
  398. package/esm/rgbHex.js.map +0 -1
  399. package/esm/rgbHex.spec.d.ts +0 -1
  400. package/esm/rgbHex.spec.js +0 -14
  401. package/esm/rgbHex.spec.js.map +0 -1
  402. package/esm/rgbaString.d.ts +0 -2
  403. package/esm/rgbaString.js +0 -4
  404. package/esm/rgbaString.js.map +0 -1
  405. package/esm/rgbaString.spec.d.ts +0 -1
  406. package/esm/rgbaString.spec.js +0 -8
  407. package/esm/rgbaString.spec.js.map +0 -1
  408. package/ts/createColors.ts +0 -35
  409. package/ts/createColorsFromMap.ts +0 -26
  410. package/ts/interfaces.ts +0 -15
  411. package/ts/rgbaString.ts +0 -5
  412. package/{ts → src/legacy}/index.ts +1 -1
@@ -0,0 +1,111 @@
1
+ import { S as Color, l as ContrastOption, t as GamutId } from "./gamut-CG1J2aat.js";
2
+ import { t as RolePair } from "./semantic-CrEIo8tS.js";
3
+ /** How `darkVariant` builds a dark scale from a light one: `mirror`, `tone-swap` or `lightness-invert`. */
4
+ type DarkStrategy = 'mirror' | 'tone-swap' | 'lightness-invert';
5
+ /** Options for `darkVariant`. */
6
+ interface DarkVariantOptions {
7
+ /** The gamut every color must fit. Default `srgb`. */
8
+ gamut?: GamutId;
9
+ }
10
+ /**
11
+ * A dark version of a light scale (ordered light to dark), with the same
12
+ * number of steps.
13
+ * - `mirror`: step n takes the color of step N+1-n, so the scale runs dark to
14
+ * light and step 1 is the old last step. Colors are unchanged.
15
+ * - `tone-swap`: each color keeps its OKLCH hue and chroma and takes the CIE
16
+ * L* tone 100 minus its own, as Material swaps tone 40 for 80. Contrast
17
+ * between two steps is kept roughly the same.
18
+ * - `lightness-invert`: OKLCH lightness is reflected within the scale's own
19
+ * range, keeping step order, with chroma eased by 10% to curb vibration on
20
+ * dark backgrounds.
21
+ */
22
+ declare function darkVariant(scale: readonly Color[], strategy?: DarkStrategy, options?: DarkVariantOptions): Color[];
23
+ type ColorInput = Color | string;
24
+ /** The hue rotations, in degrees, that each scheme adds to the base color. */
25
+ declare const SCHEMES: {
26
+ readonly __proto__: null;
27
+ readonly complementary: readonly [0, 180];
28
+ readonly split: readonly [0, 150, 210];
29
+ readonly analogous: readonly [-30, 0, 30];
30
+ readonly triadic: readonly [0, 120, 240];
31
+ readonly tetradic: readonly [0, 90, 180, 270];
32
+ };
33
+ /** A harmony scheme `harmony` accepts: `complementary`, `split`, `analogous`, `triadic` or `tetradic`. */
34
+ type HarmonyScheme = keyof typeof SCHEMES;
35
+ /** Spaces with a hue channel that a scheme can rotate in. */
36
+ type HarmonySpace = 'oklch' | 'lch' | 'hsl' | 'hwb';
37
+ /** Options for `harmony`. */
38
+ interface HarmonyOptions {
39
+ /** The space whose hue is rotated. Default `oklch`, which keeps perceived lightness steady. */
40
+ space?: HarmonySpace;
41
+ /** The gamut every color must fit. Default `srgb`. */
42
+ gamut?: GamutId;
43
+ }
44
+ /**
45
+ * The colors of a harmony: `color` rotated around the hue wheel of `space`,
46
+ * with lightness and chroma held, in the order of the scheme's angles
47
+ * (`complementary` 0 and 180; `split` 0, 150, 210; `analogous` -30, 0, 30;
48
+ * `triadic` 0, 120, 240; `tetradic` 0, 90, 180, 270). The color itself is the
49
+ * entry at angle 0, returned as given. Rotated colors are mapped into `gamut`.
50
+ * The same angle looks different in `hsl` and `oklch`, so name the space.
51
+ */
52
+ declare function harmony(color: ColorInput, scheme: HarmonyScheme, options?: HarmonyOptions): Color[];
53
+ /** Options for `harmonize`. */
54
+ interface HarmonizeOptions {
55
+ /** The most the hue may move, in degrees. Default 15. */
56
+ max?: number;
57
+ /** The share of the hue difference to move. Default 0.5. */
58
+ factor?: number;
59
+ /** The gamut the result must fit. Default `srgb`. */
60
+ gamut?: GamutId;
61
+ }
62
+ /**
63
+ * Nudges `color`'s hue toward `toward`, as Material's `Blend.harmonize` does:
64
+ * by half the hue difference, but at most 15 degrees, in OKLCH, keeping
65
+ * lightness and chroma. Use it to make a status color feel at home with a
66
+ * brand color without changing its meaning.
67
+ */
68
+ declare function harmonize(color: ColorInput, toward: ColorInput, options?: HarmonizeOptions): Color;
69
+ /**
70
+ * The opposite of a color. `lightness` flips OKLCH lightness (L becomes 1 - L)
71
+ * and keeps hue and chroma, so light turns dark without changing its hue;
72
+ * `rgb` inverts each sRGB channel, which also turns the hue to its complement.
73
+ * Alpha is kept. The result is mapped into sRGB.
74
+ */
75
+ declare function inverse(color: ColorInput, mode?: 'lightness' | 'rgb'): Color;
76
+ /** What `validate` accepts: a {@link SemanticPalette}, or any object with role pairs and/or scales. */
77
+ interface PaletteLike {
78
+ roles?: Record<string, RolePair>;
79
+ scales?: Record<string, readonly Color[]>;
80
+ }
81
+ /** Options for `validate`. */
82
+ interface ValidateOptions {
83
+ /** The measure used to re-check each pair. Default `wcag2`. */
84
+ contrast?: ContrastOption;
85
+ /** The target for a pair that carries none. Default 4.5. */
86
+ target?: number;
87
+ /** The gamut colors must fit; a color outside it was clipped or never mapped. Default `srgb`. */
88
+ gamut?: GamutId;
89
+ }
90
+ /** One problem `validate` found in a palette. */
91
+ interface PaletteIssue {
92
+ kind: 'contrast' | 'lightness' | 'gamut';
93
+ /** Where: `roles.danger`, `scales.primary[3]`. */
94
+ path: string;
95
+ message: string;
96
+ }
97
+ /** What `validate` returns: `ok` is true when `issues` is empty. */
98
+ interface ValidateResult {
99
+ ok: boolean;
100
+ issues: PaletteIssue[];
101
+ }
102
+ /**
103
+ * Checks a palette and lists what is wrong, so an agent can fix it:
104
+ * - `contrast`: a role pair whose measured contrast is under its target;
105
+ * - `lightness`: a scale whose OKLCH lightness does not change steadily in one
106
+ * direction from one step to the next;
107
+ * - `gamut`: a color outside the gamut (it would be clipped on display).
108
+ */
109
+ declare function validate(palette: PaletteLike, options?: ValidateOptions): ValidateResult;
110
+ export { validate as a, HarmonyScheme as c, harmony as d, inverse as f, darkVariant as h, ValidateResult as i, HarmonySpace as l, DarkVariantOptions as m, PaletteLike as n, HarmonizeOptions as o, DarkStrategy as p, ValidateOptions as r, HarmonyOptions as s, PaletteIssue as t, harmonize as u };
111
+ //# sourceMappingURL=index-CGKCqRqD.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CGKCqRqD.d.ts","names":[],"sources":["../src/palette/dark.ts","../src/palette/harmony.ts","../src/palette/validate.ts"],"mappings":";;;KAOY;;UAKK;;EAEhB,QAAQ;;;;;;;;;;;;;;iBAeO,YACf,gBAAgB,SAChB,WAAU,cACV,UAAS,qBACP;KC1BE,aAAa;;cAGZ;WACL;WACA;WACA;WACA;WACA;WACA;;;KAIW,6BAA6B;;KAG7B;;UAGK;;EAEhB,QAAQ;;EAER,QAAQ;;;;;;;;;;iBAeO,QAAQ,OAAO,YAAY,QAAQ,eAAe,UAAS,iBAAsB;;UAkBhF;;EAEhB;;EAEA;;EAEA,QAAQ;;;;;;;;iBASO,UAAU,OAAO,YAAY,QAAQ,YAAY,UAAS,mBAAwB;;;;;;;iBAoBlF,QAAQ,OAAO,YAAY,6BAA0C;;UC3FpE;EAChB,QAAQ,eAAe;EACvB,SAAS,wBAAwB;;;UAIjB;;EAEhB,WAAW;;EAEX;;EAEA,QAAQ;;;UAIQ;EAChB;;EAEA;EACA;;;UAIgB;EAChB;EACA,QAAQ;;;;;;;;;iBAUO,SAAS,SAAS,aAAa,UAAS,kBAAuB"}
@@ -0,0 +1,171 @@
1
+ import { C as ColorSpaceId, E as Vec3, S as Color, T as Space } from "./gamut-CG1J2aat.js";
2
+ import { t as HueMethod } from "./mix-DGlKoUw4.js";
3
+ /**
4
+ * The CSS `a98-rgb` space (Adobe RGB 1998). Components are red, green and blue in 0 to 1, with a 563/256 power transfer curve.
5
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
6
+ */
7
+ declare const a98Rgb: Space;
8
+ /** An sRGB color from a 32-bit ARGB integer, as Material Color Utilities uses. */
9
+ declare function fromArgb(argb: number): Color;
10
+ /** The unsigned 32-bit ARGB integer for an sRGB color. Convert other spaces to `srgb` first. */
11
+ declare function toArgb(color: Color): number;
12
+ /** Converts bare components between two spaces, through the XYZ-D65 hub. */
13
+ declare function convertComponents(from: Space, to: Space, c: Vec3): Vec3;
14
+ /**
15
+ * Builds `convert` over just the spaces given, so a bundle contains only those.
16
+ * `none` components become 0 when the space changes.
17
+ */
18
+ declare function createConverter(...spaces: Space[]): (color: Color, to: ColorSpaceId) => Color;
19
+ /** Euclidean distance in OKLab, the ΔEOK of CSS Color 4 gamut mapping. */
20
+ declare function deltaEOk(a: Color, b: Color): number;
21
+ /**
22
+ * Builds {@link deltaEOk} over the spaces given, plus `oklab`, so a bundle
23
+ * contains only those. A color in a space not given throws, naming that space.
24
+ */
25
+ declare function createDeltaEOk(...spaces: Space[]): (a: Color, b: Color) => number;
26
+ /**
27
+ * True when both colors are the same within `epsilon` per component. Colors in
28
+ * different spaces are compared in the first one's space. `none` equals only
29
+ * `none`, and a missing alpha equals 1.
30
+ */
31
+ declare function equals(a: Color, b: Color, epsilon?: number): boolean;
32
+ /**
33
+ * Builds {@link equals} over the spaces given, so a bundle contains only those.
34
+ * It needs no space of its own: give the spaces of both colors.
35
+ */
36
+ declare function createEquals(...spaces: Space[]): (a: Color, b: Color, epsilon?: number) => boolean;
37
+ /**
38
+ * The CSS `display-p3` space. Components are red, green and blue in 0 to 1, with the sRGB transfer curve.
39
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
40
+ */
41
+ declare const displayP3: Space;
42
+ /**
43
+ * The CSS `display-p3-linear` space: Display P3 primaries without a transfer curve. Components are red, green and blue in 0 to 1.
44
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
45
+ */
46
+ declare const displayP3Linear: Space;
47
+ /** A color that needs a context to become concrete: see {@link resolve}. */
48
+ type ColorExpr = Color | {
49
+ type: 'currentcolor';
50
+ } | {
51
+ type: 'system';
52
+ name: string;
53
+ } | {
54
+ type: 'light-dark';
55
+ light: ColorExpr;
56
+ dark: ColorExpr;
57
+ } | {
58
+ type: 'contrast-color';
59
+ color: ColorExpr;
60
+ } | {
61
+ type: 'color-mix';
62
+ space: ColorSpaceId;
63
+ hue?: HueMethod;
64
+ /** Exactly two. `percent` is 0 to 100, absent when not written. */
65
+ items: {
66
+ color: ColorExpr;
67
+ percent?: number;
68
+ }[];
69
+ } | {
70
+ /** `rgb(from red r g b)` and the like. The channels are kept as written, for `resolve` to evaluate. */
71
+ type: 'relative';
72
+ /** The function name: `rgb`, `hsl`, `hwb`, `lab`, `lch`, `oklab`, `oklch` or `color`. */
73
+ fn: string;
74
+ space: ColorSpaceId;
75
+ from: ColorExpr;
76
+ channels: [string, string, string];
77
+ alpha?: string;
78
+ };
79
+ /**
80
+ * Parses any CSS Color 4 or 5 color into a {@link ColorExpr}: everything
81
+ * `parse` takes, plus `currentcolor`, system colors, `light-dark()`,
82
+ * `color-mix()`, `contrast-color()` and relative colors such as
83
+ * `oklch(from #3b82f6 calc(l + 0.1) c h)`. A concrete color comes back as a
84
+ * plain {@link Color}; the rest are nodes that {@link resolve} turns into one.
85
+ */
86
+ declare function parseExpr(input: string): ColorExpr;
87
+ /**
88
+ * The CSS `hsl` space. Components are hue in degrees, then saturation and lightness in 0 to 100.
89
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
90
+ */
91
+ declare const hsl: Space;
92
+ /**
93
+ * The CSS `hwb` space. Components are hue in degrees, then whiteness and blackness in 0 to 100.
94
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
95
+ */
96
+ declare const hwb: Space;
97
+ /**
98
+ * The CSS `lab` space (CIE Lab, D50 white). Components are lightness in 0 to 100, then the a and b axes, which are not bounded but stay near -125 to 125 for real colors.
99
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
100
+ */
101
+ declare const lab: Space;
102
+ /**
103
+ * The CSS `lch` space, the polar form of `lab`. Components are lightness in 0 to 100, chroma (not bounded, about 0 to 150) and hue in degrees.
104
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
105
+ */
106
+ declare const lch: Space;
107
+ /**
108
+ * The CSS `oklab` space. Components are lightness in 0 to 1, then the a and b axes, which stay within about -0.4 to 0.4 for real colors.
109
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
110
+ */
111
+ declare const oklab: Space;
112
+ /**
113
+ * The CSS `oklch` space, the polar form of `oklab`. Components are lightness in 0 to 1, chroma (about 0 to 0.4) and hue in degrees.
114
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
115
+ */
116
+ declare const oklch: Space;
117
+ /**
118
+ * Parses a CSS Color 4 color: hex, named colors, `transparent`, `rgb()`,
119
+ * `hsl()`, `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()` and `color()`.
120
+ * `none` becomes `null`. Values that need a context (`currentcolor`, system
121
+ * colors) throw, because nothing here can resolve them.
122
+ */
123
+ declare function parse(input: string): Color;
124
+ /**
125
+ * The CSS `prophoto-rgb` space. Components are red, green and blue in 0 to 1. It is defined against a D50 white and converted through `xyzD50`.
126
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
127
+ */
128
+ declare const prophotoRgb: Space;
129
+ /**
130
+ * The CSS `rec2020` space. Components are red, green and blue in 0 to 1, with a 2.4 power transfer curve.
131
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
132
+ */
133
+ declare const rec2020: Space;
134
+ /** What `resolve` needs from its surroundings to settle `currentcolor`, `light-dark()` and system colors. */
135
+ interface ResolveContext {
136
+ /** What `currentcolor` means. */
137
+ currentColor?: string | ColorExpr;
138
+ /** Which side `light-dark()` takes. Default `light`. */
139
+ colorScheme?: 'light' | 'dark';
140
+ /** What each system color (`canvas`, `buttontext`, ...) means, by lowercase name. */
141
+ systemColors?: Record<string, string | ColorExpr>;
142
+ }
143
+ /**
144
+ * Turns a color, a CSS string or a {@link ColorExpr} into a concrete {@link Color}.
145
+ * `currentcolor`, system colors and `light-dark()` read `context`; nothing is
146
+ * guessed, so a missing entry throws and names the value.
147
+ */
148
+ declare function resolve(input: string | ColorExpr, context?: ResolveContext): Color;
149
+ /** Every space. Importing this pulls them all in; import single spaces to avoid that. */
150
+ declare const spaces: Record<ColorSpaceId, Space>;
151
+ /** Converts a color to any of the 15 spaces. */
152
+ declare const convert: (color: Color, to: ColorSpaceId) => Color;
153
+ /**
154
+ * The CSS `srgb` space. Components are red, green and blue in 0 to 1, with the sRGB transfer curve.
155
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
156
+ */
157
+ declare const srgb: Space;
158
+ /**
159
+ * The CSS `srgb-linear` space: sRGB primaries without a transfer curve. Components are red, green and blue in 0 to 1.
160
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
161
+ */
162
+ declare const srgbLinear: Space;
163
+ /**
164
+ * The CSS `xyz-d50` space (CIE XYZ, D50 white). Components are X, Y and Z, where Y is 1 for white.
165
+ * Pass it to `createConverter` and to the narrow helpers such as `createMix` and `createToGamut`.
166
+ */
167
+ declare const xyzD50: Space;
168
+ /** The hub every other space converts through. */
169
+ declare const xyzD65: Space;
170
+ export { a98Rgb as A, createEquals as C, createConverter as D, convertComponents as E, fromArgb as O, createDeltaEOk as S, equals as T, hsl as _, convert as a, displayP3Linear as b, resolve as c, parse as d, oklch as f, hwb as g, lab as h, srgb as i, toArgb as k, rec2020 as l, lch as m, xyzD50 as n, spaces as o, oklab as p, srgbLinear as r, ResolveContext as s, xyzD65 as t, prophotoRgb as u, ColorExpr as v, deltaEOk as w, displayP3 as x, parseExpr as y };
171
+ //# sourceMappingURL=index-Cv3iUUYE.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Cv3iUUYE.d.ts","names":["_$__types_js0.Space","_$__types_js0.Space","_$__types_js0.Space","_$__types_js0.Space","_$__types_js0.Space","_$__types_js0.Space","_$__types_js0.Color","_$__types_js0.Space","_$__types_js0.Space"],"sources":["../src/color/a98-rgb.ts","../src/color/argb.ts","../src/color/convert.ts","../src/color/compare.ts","../src/color/display-p3.ts","../src/color/display-p3-linear.ts","../src/color/expr.ts","../src/color/hsl.ts","../src/color/hwb.ts","../src/color/lab.ts","../src/color/lch.ts","../src/color/oklab.ts","../src/color/oklch.ts","../src/color/parse.ts","../src/color/prophoto-rgb.ts","../src/color/rec2020.ts","../src/color/resolve.ts","../src/color/spaces.ts","../src/color/srgb.ts","../src/color/srgb-linear.ts","../src/color/xyz-d50.ts","../src/color/xyz-d65.ts"],"mappings":";;;;;;cAUa,QAAAA;;iBCLG,SAAS,eAAe;;iBAUxB,OAAO,OAAO;;iBCXd,kBAAkB,MAAM,OAAO,IAAI,OAAO,GAAG,OAAO;;;;;iBAmCpD,mBAAmB,QAAQ,WAAW,OAAO,OAAO,IAAI,iBAAiB;;iBCjCzE,SAAS,GAAG,OAAO,GAAG;;;;;iBAetB,kBAAkB,QAAQ,WAAW,GAAG,OAAO,GAAG;;;;;;iBAalD,OAAO,GAAG,OAAO,GAAG,OAAO;;;;;iBAe3B,gBAAgB,QAAQ,WAAW,GAAG,OAAO,GAAG,OAAO;;;;;cCzC1D,WAAAC;;;;;cCAA,iBAAAC;;KCHD,YACT;EACE;;EACA;EAAgB;;EAChB;EAAoB,OAAO;EAAW,MAAM;;EAC5C;EAAwB,OAAO;;EAEjC;EACA,OAAO;EACP,MAAM;;EAEN;IAAS,OAAO;IAAW;;;;EAI3B;;EAEA;EACA,OAAO;EACP,MAAM;EACN;EACA;;;;;;;;;iBAgHa,UAAU,gBAAgB;;;;;cCzF7B,KAAK;;;;;cCzCL,KAAK;;;;;cCML,KAAK;;;;;cCPL,KAAAC;;;;;cCCA,OAAO;;;;;cCDP,OAAAC;;;;;;;iBCqIG,MAAM,gBAAgB;;;;;cC/HzB,aAAa;;;;;cCHb,SAAAC;;UCDI;;EAEhB,wBAAwB;;EAExB;;EAEA,eAAe,wBAAwB;;;;;;;iBA2DxB,QAAQ,gBAAgB,WAAW,UAAS,iBAAsB;;cCvDrE,QAAQ,OAAO,cAAc;;cAsB7B,UAAO,OAAPC,OAAO,IAAA,iBAAAA;;;;;cCjCP,MAAAC;;;;;cCAA,YAAAC;;;;;cCAA,QAAQ;;cCLR,QAAQ"}
@@ -0,0 +1,41 @@
1
+ /** Red, green and blue as whole numbers in 0 to 255. */
2
+ type RGB = [number, number, number];
3
+ /** Red, green and blue as whole numbers in 0 to 255, then alpha in 0 to 1. */
4
+ type RGBA = [number, number, number, number];
5
+ /** The alpha at the start and at the end of a run of colors, each in 0 to 1. */
6
+ type Alpha = [number, number];
7
+ /** The segments of a gradient, in order, for `createColorsFromMap`. Each has an `index` and an `rgb`. */
8
+ type ColorMap = {
9
+ /**
10
+ * Defines how fast or slow the `rgb` values will change from one segment to the next.
11
+ * i.e. the steepness of the gradient between two segments.
12
+ */
13
+ index: number;
14
+ /**
15
+ * RGB or RGBA. if RGBA, this alpha will be used instead of the alpha specified in the call.
16
+ */
17
+ rgb: RGB | RGBA;
18
+ }[];
19
+ /**
20
+ * Creates `shades` colors that step evenly from `from` to `to`. Red, green and
21
+ * blue are rounded to whole numbers. Without `alpha`, the alpha of each end
22
+ * comes from its own fourth value, then from the other end, then is 1.
23
+ * Every result is an `RGBA`.
24
+ */
25
+ declare function createColors(from: RGB | RGBA, to: RGB | RGBA, shades: number, alpha?: Alpha): RGBA[];
26
+ /**
27
+ * Create colors with specified color map.
28
+ *
29
+ * @deprecated Use `createGradient` from `color-map`. Each of its stops
30
+ * carries its own alpha, and `{ in: 'srgb' }` comes close to these results.
31
+ */
32
+ declare function createColorsFromMap(colormap: ColorMap, shades: number, alpha?: Alpha): RGBA[];
33
+ /** Formats an `RGBA` as a CSS `rgba(r,g,b,a)` string, with no spaces. */
34
+ declare function rgbaString(rgba: RGBA): string;
35
+ /**
36
+ * Convert `RGB` to `#rgb`
37
+ * JavaScript note: no check for array length, use it properly.
38
+ */
39
+ declare function rgbHex(rgb: RGB | RGBA): string;
40
+ export { Alpha as a, RGBA as c, createColors as i, rgbaString as n, ColorMap as o, createColorsFromMap as r, RGB as s, rgbHex as t };
41
+ //# sourceMappingURL=index-Dw43Hj4v.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Dw43Hj4v.d.ts","names":[],"sources":["../src/legacy/interfaces.ts","../src/legacy/createColors.ts","../src/legacy/createColorsFromMap.ts","../src/legacy/rgbaString.ts","../src/legacy/rgbHex.ts"],"mappings":";KACY;;KAEA;;KAEA;;KAGA;;;;;EAKX;;;;EAIA,KAAK,MAAM;;;;;;;;iBCTI,aACf,MAAM,MAAM,MACZ,IAAI,MAAM,MACV,gBACA,QAAO,QAIL;;;;;;;iBCPa,oBAAoB,UAAU,UAAU,gBAAgB,QAAQ,QAAQ;;iBCNxE,WAAW,MAAM;;;;;iBCGjB,OAAO,KAAK,MAAM"}
@@ -0,0 +1,72 @@
1
+ import { t as ToCssOptions } from "./serialize-C69DAmoE.js";
2
+ import { C as ColorSpaceId, S as Color } from "./gamut-CG1J2aat.js";
3
+ import { n as SemanticPalette } from "./semantic-CrEIo8tS.js";
4
+ /**
5
+ * What the exporters accept: a color, a CSS color string, an array of them (a
6
+ * scale), or an object of any of these nested to any depth. A `SemanticPalette`
7
+ * works as is: its `scales` and its role pairs export, its `meta` and ratios do not.
8
+ */
9
+ type TokenTree = SemanticPalette | Color | string | readonly TokenTree[] | {
10
+ readonly [name: string]: TokenTree;
11
+ };
12
+ /** Options for `toCssVariables`. It also takes the options of `toCss`. */
13
+ interface CssVariablesOptions extends ToCssOptions {
14
+ /** The first part of every name. Default `color`, so `primary.500` becomes `--color-primary-500`. */
15
+ prefix?: string;
16
+ /** The rule's selector. Default `:root`. */
17
+ selector?: string;
18
+ /** Convert every color to this space first. Default: print each in its own space. */
19
+ space?: ColorSpaceId;
20
+ }
21
+ /**
22
+ * Exports colors as CSS custom properties in one rule:
23
+ * `:root {\n\t--color-primary-500: oklch(0.62 0.19 260);\n}`.
24
+ */
25
+ declare function toCssVariables(tree: TokenTree, options?: CssVariablesOptions): string;
26
+ /** Options for `toDtcg` and `toDtcgValue`. */
27
+ interface DtcgOptions {
28
+ /** Add the `hex` fallback (an sRGB `#rrggbb`, gamut-mapped when the color is outside sRGB). Default `true`. */
29
+ hex?: boolean;
30
+ }
31
+ /** A color value as DTCG 2025.10 defines it. */
32
+ interface DtcgColorValue {
33
+ colorSpace: Exclude<ColorSpaceId, 'display-p3-linear'>;
34
+ components: (number | 'none')[];
35
+ alpha?: number | 'none';
36
+ hex?: string;
37
+ }
38
+ /** A DTCG color token: a `$type` of `color` and its {@link DtcgColorValue}. */
39
+ interface DtcgToken {
40
+ $type: 'color';
41
+ $value: DtcgColorValue;
42
+ }
43
+ /** A DTCG group: named tokens and nested groups, as `toDtcg` returns for a token tree. */
44
+ interface DtcgGroup {
45
+ [name: string]: DtcgToken | DtcgGroup;
46
+ }
47
+ /** One color as a DTCG color value. `display-p3-linear` is not a DTCG space, so it becomes `display-p3`. */
48
+ declare function toDtcgValue(color: Color, options?: DtcgOptions): DtcgColorValue;
49
+ /**
50
+ * Exports colors as a DTCG 2025.10 token file: nested groups whose leaves are
51
+ * `{ "$type": "color", "$value": { colorSpace, components, alpha?, hex? } }`.
52
+ * `none` components print as `"none"`, as the format asks. The result is plain
53
+ * JSON, so `JSON.stringify` writes the file.
54
+ */
55
+ declare function toDtcg(tree: TokenTree, options?: DtcgOptions): DtcgGroup;
56
+ /** Options for `toTailwindTheme`. It also takes the options of `toCss`. */
57
+ interface TailwindThemeOptions extends Omit<CssVariablesOptions, 'selector' | 'prefix'> {
58
+ /** The theme variable namespace. Default `color`, which makes `bg-primary-500` and `text-primary-500` work. */
59
+ namespace?: string;
60
+ /** Write `@theme inline`, so utilities hold the value instead of a `var()` reference. */
61
+ inline?: boolean;
62
+ /** Default `oklch`, the space Tailwind v4's own palette uses. */
63
+ space?: ColorSpaceId;
64
+ }
65
+ /**
66
+ * Exports colors as a Tailwind v4 `@theme` block. Paste it into the CSS file
67
+ * that has `@import "tailwindcss"`. An array of 11 colors gets the keys
68
+ * 50 to 950, so a `tailwind-11` scale reads like Tailwind's own.
69
+ */
70
+ declare function toTailwindTheme(tree: TokenTree, options?: TailwindThemeOptions): string;
71
+ export { DtcgOptions as a, toDtcgValue as c, TokenTree as d, DtcgGroup as i, CssVariablesOptions as l, toTailwindTheme as n, DtcgToken as o, DtcgColorValue as r, toDtcg as s, TailwindThemeOptions as t, toCssVariables as u };
72
+ //# sourceMappingURL=index-Dy8UARqO.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Dy8UARqO.d.ts","names":[],"sources":["../src/tokens/tokens.ts","../src/tokens/css.ts","../src/tokens/dtcg.ts","../src/tokens/tailwind.ts"],"mappings":";;;;;;;;KASY,YAAY,kBAAkB,0BAA0B;YAA0B,eAAe;;;UCH5F,4BAA4B;;EAE5C;;EAEA;;EAEA,QAAQ;;;;;;iBAeO,eAAe,MAAM,WAAW,UAAS;;UCpBxC;;EAEhB;;;UAIgB;EAChB,YAAY,QAAQ;EACpB;EACA;EACA;;;UAIgB;EAChB;EACA,QAAQ;;;UAIQ;GACf,eAAe,YAAY;;;iBAMb,YAAY,OAAO,OAAO,UAAS,cAAmB;;;;;;;iBAiBtD,OAAO,MAAM,WAAW,UAAS,cAAmB;;UC9CnD,6BAA6B,KAAK;;EAElD;;EAEA;;EAEA,QAAQ;;;;;;;iBAQO,gBAAgB,MAAM,WAAW,UAAS"}
package/cjs/index.d.ts CHANGED
@@ -1,5 +1,27 @@
1
- export * from './createColors.js';
2
- export * from './createColorsFromMap.js';
3
- export type { Alpha, ColorMap, RGB, RGBA } from './interfaces.js';
4
- export * from './rgbHex.js';
5
- export * from './rgbaString.js';
1
+ import { C as ColorSpaceId, E as Vec3, S as Color, T as Space, _ as createOnColor, a as inGamut, b as onColor, c as ContrastFn, d as FoundContrast, f as OnColorOptions, g as createMeets, h as createFindContrast, i as createToGamut, l as ContrastOption, m as createContrast, n as ToGamutOptions, o as toGamut, p as contrast, r as createInGamut, s as ContrastAlgorithm, t as GamutId, u as FindContrastOptions, v as findContrast, w as Component, x as wcag2, y as meets } from "./gamut-CG1J2aat.js";
2
+ import { A as a98Rgb, C as createEquals, D as createConverter, E as convertComponents, O as fromArgb, S as createDeltaEOk, T as equals, _ as hsl, a as convert, b as displayP3Linear, c as resolve, d as parse, f as oklch, g as hwb, h as lab, i as srgb, k as toArgb, l as rec2020, m as lch, n as xyzD50, o as spaces, p as oklab, r as srgbLinear, s as ResolveContext, t as xyzD65, u as prophotoRgb, v as ColorExpr, w as deltaEOk, x as displayP3, y as parseExpr } from "./index-Cv3iUUYE.js";
3
+ import { i as mix, n as MixOptions, r as createMix, t as HueMethod } from "./mix-DGlKoUw4.js";
4
+ import { i as toHex, n as createToHex, r as toCss, t as ToCssOptions } from "./serialize-C69DAmoE.js";
5
+ import { a as Alpha$1, c as RGBA$1, i as createColors$1, n as rgbaString$1, o as ColorMap$1, r as createColorsFromMap$1, s as RGB$1, t as rgbHex$1 } from "./index-Dw43Hj4v.js";
6
+ import { a as validate, c as HarmonyScheme, d as harmony, f as inverse, h as darkVariant, i as ValidateResult, l as HarmonySpace, m as DarkVariantOptions, n as PaletteLike, o as HarmonizeOptions, p as DarkStrategy, r as ValidateOptions, s as HarmonyOptions, t as PaletteIssue, u as harmonize } from "./index-CGKCqRqD.js";
7
+ import { a as semanticPalette, i as SemanticRole, n as SemanticPalette, r as SemanticPaletteOptions, t as RolePair } from "./semantic-CrEIo8tS.js";
8
+ import { a as toneColor, c as createScale, d as createGradient, f as ContrastScaleOptions, g as scaleFromBrand, h as BrandScaleOptions, i as tonalPalette, l as GradientOptions, m as createContrastScale, n as TonalPaletteOptions, o as ScaleOptions, p as ContrastStep, r as lstar, s as ScalePreset, t as MATERIAL_TONES, u as GradientStop } from "./index-BcEqCPHz.js";
9
+ import { a as DtcgOptions, c as toDtcgValue, d as TokenTree, i as DtcgGroup, l as CssVariablesOptions, n as toTailwindTheme, o as DtcgToken, r as DtcgColorValue, s as toDtcg, t as TailwindThemeOptions, u as toCssVariables } from "./index-Dy8UARqO.js";
10
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
11
+ export declare const createColors: typeof createColors$1;
12
+ /** @deprecated Use `createGradient` from `color-map`, or import it from `color-map/legacy`. The root stops exporting it in 3.0. */
13
+ export declare const createColorsFromMap: typeof createColorsFromMap$1;
14
+ /** @deprecated Import it from `color-map/legacy`, or use `toHex` from `color-map`. The root stops exporting it in 3.0. */
15
+ export declare const rgbHex: typeof rgbHex$1;
16
+ /** @deprecated Import it from `color-map/legacy`, or use `toCss` from `color-map`. The root stops exporting it in 3.0. */
17
+ export declare const rgbaString: typeof rgbaString$1;
18
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
19
+ export type Alpha = Alpha$1;
20
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
21
+ export type ColorMap = ColorMap$1;
22
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
23
+ export type RGB = RGB$1;
24
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
25
+ export type RGBA = RGBA$1;
26
+ export { type BrandScaleOptions, type Color, type ColorExpr, type ColorSpaceId, type Component, type ContrastAlgorithm, type ContrastFn, type ContrastOption, type ContrastScaleOptions, type ContrastStep, type CssVariablesOptions, type DarkStrategy, type DarkVariantOptions, type DtcgColorValue, type DtcgGroup, type DtcgOptions, type DtcgToken, type FindContrastOptions, type FoundContrast, type GamutId, type GradientOptions, type GradientStop, type HarmonizeOptions, type HarmonyOptions, type HarmonyScheme, type HarmonySpace, type HueMethod, MATERIAL_TONES, type MixOptions, type OnColorOptions, type PaletteIssue, type PaletteLike, type ResolveContext, type RolePair, type ScaleOptions, type ScalePreset, type SemanticPalette, type SemanticPaletteOptions, type SemanticRole, type Space, type TailwindThemeOptions, type ToCssOptions, type ToGamutOptions, type TokenTree, type TonalPaletteOptions, type ValidateOptions, type ValidateResult, type Vec3, a98Rgb, contrast, convert, convertComponents, createContrast, createContrastScale, createConverter, createDeltaEOk, createEquals, createFindContrast, createGradient, createInGamut, createMeets, createMix, createOnColor, createScale, createToGamut, createToHex, darkVariant, deltaEOk, displayP3, displayP3Linear, equals, findContrast, fromArgb, harmonize, harmony, hsl, hwb, inGamut, inverse, lab, lch, lstar, meets, mix, oklab, oklch, onColor, parse, parseExpr, prophotoRgb, rec2020, resolve, scaleFromBrand, semanticPalette, spaces, srgb, srgbLinear, toArgb, toCss, toCssVariables, toDtcg, toDtcgValue, toGamut, toHex, toTailwindTheme, tonalPalette, toneColor, validate, wcag2, xyzD50, xyzD65 };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["legacyCreateColors","legacyCreateColorsFromMap","legacyRgbHex","legacyRgbaString","LegacyAlpha","LegacyColorMap","LegacyRGB","LegacyRGBA"],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;qBAqBa,qBAAYA;;qBAEZ,4BAAmBC;;qBAEnB,eAAMC;;qBAEN,mBAAUC;;YAGX,QAAQC;;YAER,WAAWC;;YAEX,MAAMC;;YAEN,OAAOC"}
package/cjs/index.js CHANGED
@@ -1,21 +1,90 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./createColors.js"), exports);
18
- __exportStar(require("./createColorsFromMap.js"), exports);
19
- __exportStar(require("./rgbHex.js"), exports);
20
- __exportStar(require("./rgbaString.js"), exports);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_legacy_index = require("./legacy/index.js");
3
+ const require_parse = require("./parse-8mt2OMKf.js");
4
+ const require_color = require("./color-wNrkrhC7.js");
5
+ const require_contrast = require("./contrast-XjF5Rwui.js");
6
+ const require_mix = require("./mix-Cs4owSbW.js");
7
+ const require_serialize = require("./serialize-Ci2X0cPN.js");
8
+ const require_tone = require("./tone-BAhu-QzQ.js");
9
+ const require_palette = require("./palette-DyFV_KoJ.js");
10
+ const require_scale = require("./scale-Cq9pXrc1.js");
11
+ const require_tokens = require("./tokens-CzXxaMgM.js");
12
+ // src/index.ts
13
+ /** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */
14
+ const createColors = require_legacy_index.createColors;
15
+ /** @deprecated Use `createGradient` from `color-map`, or import it from `color-map/legacy`. The root stops exporting it in 3.0. */
16
+ const createColorsFromMap = require_legacy_index.createColorsFromMap;
17
+ /** @deprecated Import it from `color-map/legacy`, or use `toHex` from `color-map`. The root stops exporting it in 3.0. */
18
+ const rgbHex = require_legacy_index.rgbHex;
19
+ /** @deprecated Import it from `color-map/legacy`, or use `toCss` from `color-map`. The root stops exporting it in 3.0. */
20
+ const rgbaString = require_legacy_index.rgbaString;
21
+ exports.MATERIAL_TONES = require_tone.MATERIAL_TONES;
22
+ exports.a98Rgb = require_parse.a98Rgb;
23
+ exports.contrast = require_contrast.contrast;
24
+ exports.convert = require_parse.convert;
25
+ exports.convertComponents = require_parse.convertComponents;
26
+ exports.createColors = createColors;
27
+ exports.createColorsFromMap = createColorsFromMap;
28
+ exports.createContrast = require_contrast.createContrast;
29
+ exports.createContrastScale = require_scale.createContrastScale;
30
+ exports.createConverter = require_parse.createConverter;
31
+ exports.createDeltaEOk = require_parse.createDeltaEOk;
32
+ exports.createEquals = require_parse.createEquals;
33
+ exports.createFindContrast = require_contrast.createFindContrast;
34
+ exports.createGradient = require_scale.createGradient;
35
+ exports.createInGamut = require_parse.createInGamut;
36
+ exports.createMeets = require_contrast.createMeets;
37
+ exports.createMix = require_mix.createMix;
38
+ exports.createOnColor = require_contrast.createOnColor;
39
+ exports.createScale = require_scale.createScale;
40
+ exports.createToGamut = require_parse.createToGamut;
41
+ exports.createToHex = require_serialize.createToHex;
42
+ exports.darkVariant = require_palette.darkVariant;
43
+ exports.deltaEOk = require_parse.deltaEOk;
44
+ exports.displayP3 = require_parse.displayP3;
45
+ exports.displayP3Linear = require_parse.displayP3Linear;
46
+ exports.equals = require_parse.equals;
47
+ exports.findContrast = require_contrast.findContrast;
48
+ exports.fromArgb = require_color.fromArgb;
49
+ exports.harmonize = require_palette.harmonize;
50
+ exports.harmony = require_palette.harmony;
51
+ exports.hsl = require_parse.hsl;
52
+ exports.hwb = require_parse.hwb;
53
+ exports.inGamut = require_parse.inGamut;
54
+ exports.inverse = require_palette.inverse;
55
+ exports.lab = require_parse.lab;
56
+ exports.lch = require_parse.lch;
57
+ exports.lstar = require_tone.lstar;
58
+ exports.meets = require_contrast.meets;
59
+ exports.mix = require_mix.mix;
60
+ exports.oklab = require_parse.oklab;
61
+ exports.oklch = require_parse.oklch;
62
+ exports.onColor = require_contrast.onColor;
63
+ exports.parse = require_parse.parse;
64
+ exports.parseExpr = require_color.parseExpr;
65
+ exports.prophotoRgb = require_parse.prophotoRgb;
66
+ exports.rec2020 = require_parse.rec2020;
67
+ exports.resolve = require_color.resolve;
68
+ exports.rgbHex = rgbHex;
69
+ exports.rgbaString = rgbaString;
70
+ exports.scaleFromBrand = require_scale.scaleFromBrand;
71
+ exports.semanticPalette = require_palette.semanticPalette;
72
+ exports.spaces = require_parse.spaces;
73
+ exports.srgb = require_parse.srgb;
74
+ exports.srgbLinear = require_parse.srgbLinear;
75
+ exports.toArgb = require_color.toArgb;
76
+ exports.toCss = require_serialize.toCss;
77
+ exports.toCssVariables = require_tokens.toCssVariables;
78
+ exports.toDtcg = require_tokens.toDtcg;
79
+ exports.toDtcgValue = require_tokens.toDtcgValue;
80
+ exports.toGamut = require_parse.toGamut;
81
+ exports.toHex = require_serialize.toHex;
82
+ exports.toTailwindTheme = require_tokens.toTailwindTheme;
83
+ exports.tonalPalette = require_tone.tonalPalette;
84
+ exports.toneColor = require_tone.toneColor;
85
+ exports.validate = require_palette.validate;
86
+ exports.wcag2 = require_contrast.wcag2;
87
+ exports.xyzD50 = require_parse.xyzD50;
88
+ exports.xyzD65 = require_parse.xyzD65;
89
+
21
90
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,2DAAwC;AAExC,8CAA2B;AAC3B,kDAA+B"}
1
+ {"version":3,"file":"index.js","names":["legacyCreateColors","legacyCreateColorsFromMap","legacyRgbHex","legacyRgbaString"],"sources":["../src/index.ts"],"sourcesContent":["// The root re-exports the four subpaths, which stay the stable contract. The\n// legacy names stay here through 2.x, deprecated in favor of `color-map/legacy`,\n// and leave the root in 3.0. They are aliases rather than `export *` so that the\n// deprecation shows only at the root and not in `color-map/legacy`.\nimport {\n\ttype Alpha as LegacyAlpha,\n\ttype ColorMap as LegacyColorMap,\n\ttype RGB as LegacyRGB,\n\ttype RGBA as LegacyRGBA,\n\tcreateColors as legacyCreateColors,\n\tcreateColorsFromMap as legacyCreateColorsFromMap,\n\trgbaString as legacyRgbaString,\n\trgbHex as legacyRgbHex\n} from './legacy/index.js'\n\nexport * from './color/index.js'\nexport * from './palette/index.js'\nexport * from './scale/index.js'\nexport * from './tokens/index.js'\n\n/** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport const createColors = legacyCreateColors\n/** @deprecated Use `createGradient` from `color-map`, or import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport const createColorsFromMap = legacyCreateColorsFromMap\n/** @deprecated Import it from `color-map/legacy`, or use `toHex` from `color-map`. The root stops exporting it in 3.0. */\nexport const rgbHex = legacyRgbHex\n/** @deprecated Import it from `color-map/legacy`, or use `toCss` from `color-map`. The root stops exporting it in 3.0. */\nexport const rgbaString = legacyRgbaString\n\n/** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport type Alpha = LegacyAlpha\n/** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport type ColorMap = LegacyColorMap\n/** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport type RGB = LegacyRGB\n/** @deprecated Import it from `color-map/legacy`. The root stops exporting it in 3.0. */\nexport type RGBA = LegacyRGBA\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAa,eAAeA,qBAAAA;;AAE5B,MAAa,sBAAsBC,qBAAAA;;AAEnC,MAAa,SAASC,qBAAAA;;AAEtB,MAAa,aAAaC,qBAAAA"}
@@ -0,0 +1,2 @@
1
+ import { a as Alpha, c as RGBA, i as createColors, n as rgbaString, o as ColorMap, r as createColorsFromMap, s as RGB, t as rgbHex } from "../index-Dw43Hj4v.js";
2
+ export { type Alpha, type ColorMap, type RGB, type RGBA, createColors, createColorsFromMap, rgbHex, rgbaString };