@datatechsolutions/tympan-tokens 0.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 (329) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +318 -0
  3. package/dist/contrast-report.md +13955 -0
  4. package/dist/dtcg/astrlabe.dark-high.tokens.json +2947 -0
  5. package/dist/dtcg/astrlabe.dark.tokens.json +2947 -0
  6. package/dist/dtcg/astrlabe.light-high.tokens.json +2947 -0
  7. package/dist/dtcg/astrlabe.light.tokens.json +2947 -0
  8. package/dist/dtcg/base.tokens.json +422 -0
  9. package/dist/dtcg/density.comfortable.tokens.json +48 -0
  10. package/dist/dtcg/density.compact.tokens.json +48 -0
  11. package/dist/dtcg/density.default.tokens.json +48 -0
  12. package/dist/dtcg/fakhir.dark-high.tokens.json +2971 -0
  13. package/dist/dtcg/fakhir.dark.tokens.json +2971 -0
  14. package/dist/dtcg/fakhir.light-high.tokens.json +2971 -0
  15. package/dist/dtcg/fakhir.light.tokens.json +2971 -0
  16. package/dist/dtcg/flow.tokens.json +675 -0
  17. package/dist/dtcg/high-contrast.dark.tokens.json +2943 -0
  18. package/dist/dtcg/high-contrast.light.tokens.json +2943 -0
  19. package/dist/dtcg/neutral.dark-high.tokens.json +2947 -0
  20. package/dist/dtcg/neutral.dark.tokens.json +2947 -0
  21. package/dist/dtcg/neutral.light-high.tokens.json +2947 -0
  22. package/dist/dtcg/neutral.light.tokens.json +2947 -0
  23. package/dist/dtcg/print/print-aquarela.dark.tokens.json +3014 -0
  24. package/dist/dtcg/print/print-aquarela.light.tokens.json +3009 -0
  25. package/dist/dtcg/print/print-art-nouveau.dark.tokens.json +2944 -0
  26. package/dist/dtcg/print/print-art-nouveau.light.tokens.json +2944 -0
  27. package/dist/dtcg/print/print-atlas-oficial.dark.tokens.json +2945 -0
  28. package/dist/dtcg/print/print-atlas-oficial.light.tokens.json +2945 -0
  29. package/dist/dtcg/print/print-azulejo-modernista.dark.tokens.json +2946 -0
  30. package/dist/dtcg/print/print-azulejo-modernista.light.tokens.json +2946 -0
  31. package/dist/dtcg/print/print-bauhaus.dark.tokens.json +2946 -0
  32. package/dist/dtcg/print/print-bauhaus.light.tokens.json +2942 -0
  33. package/dist/dtcg/print/print-blocos-coloridos.dark.tokens.json +2974 -0
  34. package/dist/dtcg/print/print-blocos-coloridos.light.tokens.json +2967 -0
  35. package/dist/dtcg/print/print-brutalista.dark.tokens.json +2956 -0
  36. package/dist/dtcg/print/print-brutalista.light.tokens.json +2956 -0
  37. package/dist/dtcg/print/print-caderno.dark.tokens.json +2958 -0
  38. package/dist/dtcg/print/print-caderno.light.tokens.json +2954 -0
  39. package/dist/dtcg/print/print-cartao-postal.dark.tokens.json +2958 -0
  40. package/dist/dtcg/print/print-cartao-postal.light.tokens.json +2954 -0
  41. package/dist/dtcg/print/print-cientifico.dark.tokens.json +2944 -0
  42. package/dist/dtcg/print/print-cientifico.light.tokens.json +2944 -0
  43. package/dist/dtcg/print/print-concretismo.dark.tokens.json +2946 -0
  44. package/dist/dtcg/print/print-concretismo.light.tokens.json +2942 -0
  45. package/dist/dtcg/print/print-construtivismo.dark.tokens.json +2946 -0
  46. package/dist/dtcg/print/print-construtivismo.light.tokens.json +2946 -0
  47. package/dist/dtcg/print/print-cordel.dark.tokens.json +2958 -0
  48. package/dist/dtcg/print/print-cordel.light.tokens.json +2954 -0
  49. package/dist/dtcg/print/print-dados-br.dark.tokens.json +2959 -0
  50. package/dist/dtcg/print/print-dados-br.light.tokens.json +2956 -0
  51. package/dist/dtcg/print/print-dashboard.dark.tokens.json +3015 -0
  52. package/dist/dtcg/print/print-dashboard.light.tokens.json +3007 -0
  53. package/dist/dtcg/print/print-diagrama-modernista.dark.tokens.json +2946 -0
  54. package/dist/dtcg/print/print-diagrama-modernista.light.tokens.json +2942 -0
  55. package/dist/dtcg/print/print-divulgacao.dark.tokens.json +2942 -0
  56. package/dist/dtcg/print/print-divulgacao.light.tokens.json +2938 -0
  57. package/dist/dtcg/print/print-fluxo-historico.dark.tokens.json +2944 -0
  58. package/dist/dtcg/print/print-fluxo-historico.light.tokens.json +2941 -0
  59. package/dist/dtcg/print/print-grade-holandesa.dark.tokens.json +2946 -0
  60. package/dist/dtcg/print/print-grade-holandesa.light.tokens.json +2942 -0
  61. package/dist/dtcg/print/print-graficos-1900.dark.tokens.json +2959 -0
  62. package/dist/dtcg/print/print-graficos-1900.light.tokens.json +2955 -0
  63. package/dist/dtcg/print/print-infografico-ilustrado.dark.tokens.json +2974 -0
  64. package/dist/dtcg/print/print-infografico-ilustrado.light.tokens.json +2970 -0
  65. package/dist/dtcg/print/print-isotype.dark.tokens.json +2946 -0
  66. package/dist/dtcg/print/print-isotype.light.tokens.json +2946 -0
  67. package/dist/dtcg/print/print-jornal-1959.dark.tokens.json +2944 -0
  68. package/dist/dtcg/print/print-jornal-1959.light.tokens.json +2944 -0
  69. package/dist/dtcg/print/print-jornal.dark.tokens.json +2958 -0
  70. package/dist/dtcg/print/print-jornal.light.tokens.json +2951 -0
  71. package/dist/dtcg/print/print-mapa-de-metro.dark.tokens.json +2946 -0
  72. package/dist/dtcg/print/print-mapa-de-metro.light.tokens.json +2946 -0
  73. package/dist/dtcg/print/print-memphis.dark.tokens.json +2942 -0
  74. package/dist/dtcg/print/print-memphis.light.tokens.json +2938 -0
  75. package/dist/dtcg/print/print-minimo-de-tinta.dark.tokens.json +2958 -0
  76. package/dist/dtcg/print/print-minimo-de-tinta.light.tokens.json +2951 -0
  77. package/dist/dtcg/print/print-papel-recortado.dark.tokens.json +2946 -0
  78. package/dist/dtcg/print/print-papel-recortado.light.tokens.json +2942 -0
  79. package/dist/dtcg/print/print-papel-salmao.dark.tokens.json +2944 -0
  80. package/dist/dtcg/print/print-papel-salmao.light.tokens.json +2941 -0
  81. package/dist/dtcg/print/print-pictogramas.dark.tokens.json +2946 -0
  82. package/dist/dtcg/print/print-pictogramas.light.tokens.json +2942 -0
  83. package/dist/dtcg/print/print-pop-art.dark.tokens.json +2942 -0
  84. package/dist/dtcg/print/print-pop-art.light.tokens.json +2938 -0
  85. package/dist/dtcg/print/print-prancheta-clara.dark.tokens.json +2960 -0
  86. package/dist/dtcg/print/print-prancheta-clara.light.tokens.json +2956 -0
  87. package/dist/dtcg/print/print-prancheta.dark.tokens.json +2956 -0
  88. package/dist/dtcg/print/print-prancheta.light.tokens.json +2960 -0
  89. package/dist/dtcg/print/print-proporcao-modular.dark.tokens.json +2945 -0
  90. package/dist/dtcg/print/print-proporcao-modular.light.tokens.json +2941 -0
  91. package/dist/dtcg/print/print-riso.dark.tokens.json +2960 -0
  92. package/dist/dtcg/print/print-riso.light.tokens.json +2956 -0
  93. package/dist/dtcg/print/print-semanario.dark.tokens.json +2944 -0
  94. package/dist/dtcg/print/print-semanario.light.tokens.json +2937 -0
  95. package/dist/dtcg/print/print-sinalizacao.dark.tokens.json +2946 -0
  96. package/dist/dtcg/print/print-sinalizacao.light.tokens.json +2942 -0
  97. package/dist/dtcg/print/print-suico.dark.tokens.json +2960 -0
  98. package/dist/dtcg/print/print-suico.light.tokens.json +2956 -0
  99. package/dist/dtcg/print/print-tropicalia.dark.tokens.json +2945 -0
  100. package/dist/dtcg/print/print-tropicalia.light.tokens.json +2941 -0
  101. package/dist/dtcg/print-aquarela.dark-high.tokens.json +3014 -0
  102. package/dist/dtcg/print-aquarela.dark.tokens.json +3014 -0
  103. package/dist/dtcg/print-aquarela.light-high.tokens.json +3014 -0
  104. package/dist/dtcg/print-aquarela.light.tokens.json +3009 -0
  105. package/dist/dtcg/print-art-nouveau.dark-high.tokens.json +2944 -0
  106. package/dist/dtcg/print-art-nouveau.dark.tokens.json +2944 -0
  107. package/dist/dtcg/print-art-nouveau.light-high.tokens.json +2944 -0
  108. package/dist/dtcg/print-art-nouveau.light.tokens.json +2944 -0
  109. package/dist/dtcg/print-atlas-oficial.dark-high.tokens.json +2945 -0
  110. package/dist/dtcg/print-atlas-oficial.dark.tokens.json +2945 -0
  111. package/dist/dtcg/print-atlas-oficial.light-high.tokens.json +2945 -0
  112. package/dist/dtcg/print-atlas-oficial.light.tokens.json +2945 -0
  113. package/dist/dtcg/print-azulejo-modernista.dark-high.tokens.json +2946 -0
  114. package/dist/dtcg/print-azulejo-modernista.dark.tokens.json +2946 -0
  115. package/dist/dtcg/print-azulejo-modernista.light-high.tokens.json +2946 -0
  116. package/dist/dtcg/print-azulejo-modernista.light.tokens.json +2946 -0
  117. package/dist/dtcg/print-bauhaus.dark-high.tokens.json +2946 -0
  118. package/dist/dtcg/print-bauhaus.dark.tokens.json +2946 -0
  119. package/dist/dtcg/print-bauhaus.light-high.tokens.json +2946 -0
  120. package/dist/dtcg/print-bauhaus.light.tokens.json +2942 -0
  121. package/dist/dtcg/print-blocos-coloridos.dark-high.tokens.json +2974 -0
  122. package/dist/dtcg/print-blocos-coloridos.dark.tokens.json +2974 -0
  123. package/dist/dtcg/print-blocos-coloridos.light-high.tokens.json +2974 -0
  124. package/dist/dtcg/print-blocos-coloridos.light.tokens.json +2967 -0
  125. package/dist/dtcg/print-brutalista.dark-high.tokens.json +2956 -0
  126. package/dist/dtcg/print-brutalista.dark.tokens.json +2956 -0
  127. package/dist/dtcg/print-brutalista.light-high.tokens.json +2956 -0
  128. package/dist/dtcg/print-brutalista.light.tokens.json +2956 -0
  129. package/dist/dtcg/print-caderno.dark-high.tokens.json +2958 -0
  130. package/dist/dtcg/print-caderno.dark.tokens.json +2958 -0
  131. package/dist/dtcg/print-caderno.light-high.tokens.json +2958 -0
  132. package/dist/dtcg/print-caderno.light.tokens.json +2954 -0
  133. package/dist/dtcg/print-cartao-postal.dark-high.tokens.json +2958 -0
  134. package/dist/dtcg/print-cartao-postal.dark.tokens.json +2958 -0
  135. package/dist/dtcg/print-cartao-postal.light-high.tokens.json +2958 -0
  136. package/dist/dtcg/print-cartao-postal.light.tokens.json +2954 -0
  137. package/dist/dtcg/print-cientifico.dark-high.tokens.json +2944 -0
  138. package/dist/dtcg/print-cientifico.dark.tokens.json +2944 -0
  139. package/dist/dtcg/print-cientifico.light-high.tokens.json +2944 -0
  140. package/dist/dtcg/print-cientifico.light.tokens.json +2944 -0
  141. package/dist/dtcg/print-concretismo.dark-high.tokens.json +2946 -0
  142. package/dist/dtcg/print-concretismo.dark.tokens.json +2946 -0
  143. package/dist/dtcg/print-concretismo.light-high.tokens.json +2946 -0
  144. package/dist/dtcg/print-concretismo.light.tokens.json +2942 -0
  145. package/dist/dtcg/print-construtivismo.dark-high.tokens.json +2946 -0
  146. package/dist/dtcg/print-construtivismo.dark.tokens.json +2946 -0
  147. package/dist/dtcg/print-construtivismo.light-high.tokens.json +2946 -0
  148. package/dist/dtcg/print-construtivismo.light.tokens.json +2946 -0
  149. package/dist/dtcg/print-cordel.dark-high.tokens.json +2958 -0
  150. package/dist/dtcg/print-cordel.dark.tokens.json +2958 -0
  151. package/dist/dtcg/print-cordel.light-high.tokens.json +2958 -0
  152. package/dist/dtcg/print-cordel.light.tokens.json +2954 -0
  153. package/dist/dtcg/print-dados-br.dark-high.tokens.json +2959 -0
  154. package/dist/dtcg/print-dados-br.dark.tokens.json +2959 -0
  155. package/dist/dtcg/print-dados-br.light-high.tokens.json +2959 -0
  156. package/dist/dtcg/print-dados-br.light.tokens.json +2956 -0
  157. package/dist/dtcg/print-dashboard.dark-high.tokens.json +3015 -0
  158. package/dist/dtcg/print-dashboard.dark.tokens.json +3015 -0
  159. package/dist/dtcg/print-dashboard.light-high.tokens.json +3015 -0
  160. package/dist/dtcg/print-dashboard.light.tokens.json +3007 -0
  161. package/dist/dtcg/print-diagrama-modernista.dark-high.tokens.json +2946 -0
  162. package/dist/dtcg/print-diagrama-modernista.dark.tokens.json +2946 -0
  163. package/dist/dtcg/print-diagrama-modernista.light-high.tokens.json +2946 -0
  164. package/dist/dtcg/print-diagrama-modernista.light.tokens.json +2942 -0
  165. package/dist/dtcg/print-divulgacao.dark-high.tokens.json +2942 -0
  166. package/dist/dtcg/print-divulgacao.dark.tokens.json +2942 -0
  167. package/dist/dtcg/print-divulgacao.light-high.tokens.json +2942 -0
  168. package/dist/dtcg/print-divulgacao.light.tokens.json +2938 -0
  169. package/dist/dtcg/print-fluxo-historico.dark-high.tokens.json +2944 -0
  170. package/dist/dtcg/print-fluxo-historico.dark.tokens.json +2944 -0
  171. package/dist/dtcg/print-fluxo-historico.light-high.tokens.json +2944 -0
  172. package/dist/dtcg/print-fluxo-historico.light.tokens.json +2941 -0
  173. package/dist/dtcg/print-grade-holandesa.dark-high.tokens.json +2946 -0
  174. package/dist/dtcg/print-grade-holandesa.dark.tokens.json +2946 -0
  175. package/dist/dtcg/print-grade-holandesa.light-high.tokens.json +2946 -0
  176. package/dist/dtcg/print-grade-holandesa.light.tokens.json +2942 -0
  177. package/dist/dtcg/print-graficos-1900.dark-high.tokens.json +2959 -0
  178. package/dist/dtcg/print-graficos-1900.dark.tokens.json +2959 -0
  179. package/dist/dtcg/print-graficos-1900.light-high.tokens.json +2959 -0
  180. package/dist/dtcg/print-graficos-1900.light.tokens.json +2955 -0
  181. package/dist/dtcg/print-infografico-ilustrado.dark-high.tokens.json +2974 -0
  182. package/dist/dtcg/print-infografico-ilustrado.dark.tokens.json +2974 -0
  183. package/dist/dtcg/print-infografico-ilustrado.light-high.tokens.json +2974 -0
  184. package/dist/dtcg/print-infografico-ilustrado.light.tokens.json +2970 -0
  185. package/dist/dtcg/print-isotype.dark-high.tokens.json +2946 -0
  186. package/dist/dtcg/print-isotype.dark.tokens.json +2946 -0
  187. package/dist/dtcg/print-isotype.light-high.tokens.json +2946 -0
  188. package/dist/dtcg/print-isotype.light.tokens.json +2946 -0
  189. package/dist/dtcg/print-jornal-1959.dark-high.tokens.json +2944 -0
  190. package/dist/dtcg/print-jornal-1959.dark.tokens.json +2944 -0
  191. package/dist/dtcg/print-jornal-1959.light-high.tokens.json +2944 -0
  192. package/dist/dtcg/print-jornal-1959.light.tokens.json +2944 -0
  193. package/dist/dtcg/print-jornal.dark-high.tokens.json +2958 -0
  194. package/dist/dtcg/print-jornal.dark.tokens.json +2958 -0
  195. package/dist/dtcg/print-jornal.light-high.tokens.json +2958 -0
  196. package/dist/dtcg/print-jornal.light.tokens.json +2951 -0
  197. package/dist/dtcg/print-mapa-de-metro.dark-high.tokens.json +2946 -0
  198. package/dist/dtcg/print-mapa-de-metro.dark.tokens.json +2946 -0
  199. package/dist/dtcg/print-mapa-de-metro.light-high.tokens.json +2946 -0
  200. package/dist/dtcg/print-mapa-de-metro.light.tokens.json +2946 -0
  201. package/dist/dtcg/print-memphis.dark-high.tokens.json +2942 -0
  202. package/dist/dtcg/print-memphis.dark.tokens.json +2942 -0
  203. package/dist/dtcg/print-memphis.light-high.tokens.json +2942 -0
  204. package/dist/dtcg/print-memphis.light.tokens.json +2938 -0
  205. package/dist/dtcg/print-minimo-de-tinta.dark-high.tokens.json +2958 -0
  206. package/dist/dtcg/print-minimo-de-tinta.dark.tokens.json +2958 -0
  207. package/dist/dtcg/print-minimo-de-tinta.light-high.tokens.json +2958 -0
  208. package/dist/dtcg/print-minimo-de-tinta.light.tokens.json +2951 -0
  209. package/dist/dtcg/print-papel-recortado.dark-high.tokens.json +2946 -0
  210. package/dist/dtcg/print-papel-recortado.dark.tokens.json +2946 -0
  211. package/dist/dtcg/print-papel-recortado.light-high.tokens.json +2946 -0
  212. package/dist/dtcg/print-papel-recortado.light.tokens.json +2942 -0
  213. package/dist/dtcg/print-papel-salmao.dark-high.tokens.json +2944 -0
  214. package/dist/dtcg/print-papel-salmao.dark.tokens.json +2944 -0
  215. package/dist/dtcg/print-papel-salmao.light-high.tokens.json +2944 -0
  216. package/dist/dtcg/print-papel-salmao.light.tokens.json +2941 -0
  217. package/dist/dtcg/print-pictogramas.dark-high.tokens.json +2946 -0
  218. package/dist/dtcg/print-pictogramas.dark.tokens.json +2946 -0
  219. package/dist/dtcg/print-pictogramas.light-high.tokens.json +2946 -0
  220. package/dist/dtcg/print-pictogramas.light.tokens.json +2942 -0
  221. package/dist/dtcg/print-pop-art.dark-high.tokens.json +2942 -0
  222. package/dist/dtcg/print-pop-art.dark.tokens.json +2942 -0
  223. package/dist/dtcg/print-pop-art.light-high.tokens.json +2942 -0
  224. package/dist/dtcg/print-pop-art.light.tokens.json +2938 -0
  225. package/dist/dtcg/print-prancheta-clara.dark-high.tokens.json +2960 -0
  226. package/dist/dtcg/print-prancheta-clara.dark.tokens.json +2960 -0
  227. package/dist/dtcg/print-prancheta-clara.light-high.tokens.json +2960 -0
  228. package/dist/dtcg/print-prancheta-clara.light.tokens.json +2956 -0
  229. package/dist/dtcg/print-prancheta.dark-high.tokens.json +2960 -0
  230. package/dist/dtcg/print-prancheta.dark.tokens.json +2956 -0
  231. package/dist/dtcg/print-prancheta.light-high.tokens.json +2960 -0
  232. package/dist/dtcg/print-prancheta.light.tokens.json +2960 -0
  233. package/dist/dtcg/print-proporcao-modular.dark-high.tokens.json +2945 -0
  234. package/dist/dtcg/print-proporcao-modular.dark.tokens.json +2945 -0
  235. package/dist/dtcg/print-proporcao-modular.light-high.tokens.json +2945 -0
  236. package/dist/dtcg/print-proporcao-modular.light.tokens.json +2941 -0
  237. package/dist/dtcg/print-riso.dark-high.tokens.json +2960 -0
  238. package/dist/dtcg/print-riso.dark.tokens.json +2960 -0
  239. package/dist/dtcg/print-riso.light-high.tokens.json +2960 -0
  240. package/dist/dtcg/print-riso.light.tokens.json +2956 -0
  241. package/dist/dtcg/print-semanario.dark-high.tokens.json +2944 -0
  242. package/dist/dtcg/print-semanario.dark.tokens.json +2944 -0
  243. package/dist/dtcg/print-semanario.light-high.tokens.json +2944 -0
  244. package/dist/dtcg/print-semanario.light.tokens.json +2937 -0
  245. package/dist/dtcg/print-sinalizacao.dark-high.tokens.json +2946 -0
  246. package/dist/dtcg/print-sinalizacao.dark.tokens.json +2946 -0
  247. package/dist/dtcg/print-sinalizacao.light-high.tokens.json +2946 -0
  248. package/dist/dtcg/print-sinalizacao.light.tokens.json +2942 -0
  249. package/dist/dtcg/print-suico.dark-high.tokens.json +2960 -0
  250. package/dist/dtcg/print-suico.dark.tokens.json +2960 -0
  251. package/dist/dtcg/print-suico.light-high.tokens.json +2960 -0
  252. package/dist/dtcg/print-suico.light.tokens.json +2956 -0
  253. package/dist/dtcg/print-tropicalia.dark-high.tokens.json +2945 -0
  254. package/dist/dtcg/print-tropicalia.dark.tokens.json +2945 -0
  255. package/dist/dtcg/print-tropicalia.light-high.tokens.json +2945 -0
  256. package/dist/dtcg/print-tropicalia.light.tokens.json +2941 -0
  257. package/dist/dtcg/tympan.dark-high.tokens.json +2971 -0
  258. package/dist/dtcg/tympan.dark.tokens.json +2971 -0
  259. package/dist/dtcg/tympan.light-high.tokens.json +2971 -0
  260. package/dist/dtcg/tympan.light.tokens.json +2971 -0
  261. package/dist/index.d.ts +642 -0
  262. package/dist/index.js +4873 -0
  263. package/dist/index.js.map +1 -0
  264. package/dist/print-aliases.d.ts +54 -0
  265. package/dist/print-aliases.js +71 -0
  266. package/dist/print-aliases.js.map +1 -0
  267. package/dist/print-themes/print-aquarela.css +1483 -0
  268. package/dist/print-themes/print-art-nouveau.css +1467 -0
  269. package/dist/print-themes/print-atlas-oficial.css +1467 -0
  270. package/dist/print-themes/print-azulejo-modernista.css +1467 -0
  271. package/dist/print-themes/print-bauhaus.css +1467 -0
  272. package/dist/print-themes/print-blocos-coloridos.css +1467 -0
  273. package/dist/print-themes/print-brutalista.css +1475 -0
  274. package/dist/print-themes/print-caderno.css +1483 -0
  275. package/dist/print-themes/print-cartao-postal.css +1483 -0
  276. package/dist/print-themes/print-cientifico.css +1467 -0
  277. package/dist/print-themes/print-concretismo.css +1467 -0
  278. package/dist/print-themes/print-construtivismo.css +1467 -0
  279. package/dist/print-themes/print-cordel.css +1483 -0
  280. package/dist/print-themes/print-dados-br.css +1475 -0
  281. package/dist/print-themes/print-dashboard.css +1475 -0
  282. package/dist/print-themes/print-diagrama-modernista.css +1467 -0
  283. package/dist/print-themes/print-divulgacao.css +1467 -0
  284. package/dist/print-themes/print-fluxo-historico.css +1475 -0
  285. package/dist/print-themes/print-grade-holandesa.css +1475 -0
  286. package/dist/print-themes/print-graficos-1900.css +1483 -0
  287. package/dist/print-themes/print-infografico-ilustrado.css +1467 -0
  288. package/dist/print-themes/print-isotype.css +1467 -0
  289. package/dist/print-themes/print-jornal-1959.css +1467 -0
  290. package/dist/print-themes/print-jornal.css +1475 -0
  291. package/dist/print-themes/print-mapa-de-metro.css +1467 -0
  292. package/dist/print-themes/print-memphis.css +1467 -0
  293. package/dist/print-themes/print-minimo-de-tinta.css +1475 -0
  294. package/dist/print-themes/print-papel-recortado.css +1467 -0
  295. package/dist/print-themes/print-papel-salmao.css +1467 -0
  296. package/dist/print-themes/print-pictogramas.css +1467 -0
  297. package/dist/print-themes/print-pop-art.css +1467 -0
  298. package/dist/print-themes/print-prancheta-clara.css +1483 -0
  299. package/dist/print-themes/print-prancheta.css +1483 -0
  300. package/dist/print-themes/print-proporcao-modular.css +1467 -0
  301. package/dist/print-themes/print-riso.css +1483 -0
  302. package/dist/print-themes/print-semanario.css +1467 -0
  303. package/dist/print-themes/print-sinalizacao.css +1467 -0
  304. package/dist/print-themes/print-suico.css +1475 -0
  305. package/dist/print-themes/print-tropicalia.css +1467 -0
  306. package/dist/print-themes.css +57215 -0
  307. package/dist/print-themes.json +236 -0
  308. package/dist/tokens.css +64416 -0
  309. package/dist/tokens.json +31449 -0
  310. package/dist/values.d.ts +14 -0
  311. package/dist/values.js +31454 -0
  312. package/package.json +67 -0
  313. package/src/base/motion.tokens.json +15 -0
  314. package/src/base/space.tokens.json +122 -0
  315. package/src/base/type.tokens.json +227 -0
  316. package/src/base/z.tokens.json +13 -0
  317. package/src/color.ts +239 -0
  318. package/src/dtcg.ts +102 -0
  319. package/src/flow.ts +130 -0
  320. package/src/index.ts +17 -0
  321. package/src/presets.ts +135 -0
  322. package/src/presets.ts.diff +26 -0
  323. package/src/print-aliases.ts +84 -0
  324. package/src/print-presets.ts +1611 -0
  325. package/src/print-themes.ts +404 -0
  326. package/src/scripts.ts +75 -0
  327. package/src/stylesheet.ts +238 -0
  328. package/src/theme.ts +553 -0
  329. package/src/theme.ts.rej +16 -0
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@datatechsolutions/tympan-tokens",
3
+ "version": "0.3.0",
4
+ "description": "Tympan design tokens: W3C DTCG source (colour, space, radius, type, elevation and glass, motion, z) and an OKLCH theme generator, with the tympan, fakhir, neutral and high-contrast presets in light and dark (plus opt-in UI themes derived from the print book styles), built to --ty-* CSS custom properties, JSON and a TypeScript export.",
5
+ "license": "FSL-1.1-ALv2",
6
+ "author": "Natalia Mesquita",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/datatechsolutionsbr/tympan.git",
10
+ "directory": "packages/tokens"
11
+ },
12
+ "keywords": [
13
+ "design-tokens",
14
+ "dtcg",
15
+ "oklch",
16
+ "theme",
17
+ "css-custom-properties",
18
+ "wcag"
19
+ ],
20
+ "type": "module",
21
+ "sideEffects": [
22
+ "*.css"
23
+ ],
24
+ "main": "./dist/index.js",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "tympan-source": "./src/index.ts",
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "./values": {
34
+ "types": "./dist/values.d.ts",
35
+ "default": "./dist/values.js"
36
+ },
37
+ "./print-aliases": {
38
+ "tympan-source": "./src/print-aliases.ts",
39
+ "types": "./dist/print-aliases.d.ts",
40
+ "default": "./dist/print-aliases.js"
41
+ },
42
+ "./tokens.css": "./dist/tokens.css",
43
+ "./print-themes.css": "./dist/print-themes.css",
44
+ "./print-themes/*": "./dist/print-themes/*",
45
+ "./print-themes.json": "./dist/print-themes.json",
46
+ "./tokens.json": "./dist/tokens.json",
47
+ "./dtcg/*": "./dist/dtcg/*",
48
+ "./package.json": "./package.json"
49
+ },
50
+ "files": [
51
+ "dist",
52
+ "src",
53
+ "LICENSE",
54
+ "README.md"
55
+ ],
56
+ "scripts": {
57
+ "build": "node scripts/build.mjs && tsdown",
58
+ "typecheck": "tsc --noEmit -p tsconfig.json && node scripts/build.mjs --check",
59
+ "test": "vitest run"
60
+ },
61
+ "devDependencies": {
62
+ "style-dictionary": "^5.5.5"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ }
67
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$description": "Motion (design direction §2.7). Durations drop to zero under prefers-reduced-motion.",
3
+ "duration": {
4
+ "$type": "duration",
5
+ "instant": { "$value": { "value": 90, "unit": "ms" }, "$description": "Hover, press." },
6
+ "quick": { "$value": { "value": 150, "unit": "ms" }, "$description": "Open a menu, switch a tab." },
7
+ "base": { "$value": { "value": 240, "unit": "ms" }, "$description": "Drawer and evidence panel entry." },
8
+ "pulse": { "$value": { "value": 1600, "unit": "ms" }, "$description": "Skeleton opacity pulse period (§2.12)." }
9
+ },
10
+ "ease": {
11
+ "$type": "cubicBezier",
12
+ "enter": { "$value": [0.2, 0, 0, 1], "$description": "Entries." },
13
+ "exit": { "$value": [0.4, 0, 1, 1], "$description": "Exits." }
14
+ }
15
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$description": "Spacing scale on a 4 px base (design direction §2.1).",
3
+ "space": {
4
+ "$type": "dimension",
5
+ "1": {
6
+ "$value": {
7
+ "value": 4,
8
+ "unit": "px"
9
+ }
10
+ },
11
+ "2": {
12
+ "$value": {
13
+ "value": 8,
14
+ "unit": "px"
15
+ }
16
+ },
17
+ "3": {
18
+ "$value": {
19
+ "value": 12,
20
+ "unit": "px"
21
+ }
22
+ },
23
+ "4": {
24
+ "$value": {
25
+ "value": 16,
26
+ "unit": "px"
27
+ }
28
+ },
29
+ "5": {
30
+ "$value": {
31
+ "value": 24,
32
+ "unit": "px"
33
+ }
34
+ },
35
+ "6": {
36
+ "$value": {
37
+ "value": 32,
38
+ "unit": "px"
39
+ }
40
+ },
41
+ "7": {
42
+ "$value": {
43
+ "value": 48,
44
+ "unit": "px"
45
+ }
46
+ },
47
+ "8": {
48
+ "$value": {
49
+ "value": 64,
50
+ "unit": "px"
51
+ }
52
+ },
53
+ "9": {
54
+ "$value": {
55
+ "value": 96,
56
+ "unit": "px"
57
+ }
58
+ }
59
+ },
60
+ "layout": {
61
+ "$type": "dimension",
62
+ "sidebar": {
63
+ "$value": {
64
+ "value": 272,
65
+ "unit": "px"
66
+ },
67
+ "$description": "Side navigation width (§2.8)."
68
+ },
69
+ "rail": {
70
+ "$value": {
71
+ "value": 72,
72
+ "unit": "px"
73
+ },
74
+ "$description": "Collapsed navigation rail (§2.8)."
75
+ },
76
+ "topbar": {
77
+ "$value": {
78
+ "value": 56,
79
+ "unit": "px"
80
+ },
81
+ "$description": "Top bar height (§2.8)."
82
+ },
83
+ "aside": {
84
+ "$value": {
85
+ "value": 420,
86
+ "unit": "px"
87
+ },
88
+ "$description": "Evidence panel column (§2.8)."
89
+ },
90
+ "reading": {
91
+ "$value": {
92
+ "value": 1200,
93
+ "unit": "px"
94
+ },
95
+ "$description": "Reading content max width."
96
+ },
97
+ "data": {
98
+ "$value": {
99
+ "value": 1440,
100
+ "unit": "px"
101
+ },
102
+ "$description": "Data content max width."
103
+ },
104
+ "scroll-padding": {
105
+ "$value": {
106
+ "value": 80,
107
+ "unit": "px"
108
+ },
109
+ "$description": "scroll-padding-top under the sticky bar (§2.6)."
110
+ }
111
+ },
112
+ "control": {
113
+ "$type": "dimension",
114
+ "target": {
115
+ "$value": {
116
+ "value": 44,
117
+ "unit": "px"
118
+ },
119
+ "$description": "Minimum touch hit area (§2.10); constant across densities."
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,227 @@
1
+ {
2
+ "$description": "Typography (design direction §2.2).",
3
+ "font": {
4
+ "family": {
5
+ "$type": "fontFamily",
6
+ "serif": {
7
+ "$value": [
8
+ "Source Serif 4",
9
+ "Source Serif Pro",
10
+ "Noto Serif",
11
+ "Georgia",
12
+ "Noto Naskh Arabic",
13
+ "Noto Serif Hebrew",
14
+ "Noto Serif Devanagari",
15
+ "Noto Serif Thai",
16
+ "Noto Serif Ethiopic",
17
+ "Noto Serif JP",
18
+ "Noto Serif SC",
19
+ "Noto Serif KR",
20
+ "serif"
21
+ ],
22
+ "$description": "Headings h1 to h3 and KPI numbers only."
23
+ },
24
+ "sans": {
25
+ "$value": [
26
+ "IBM Plex Sans",
27
+ "Noto Sans",
28
+ "system-ui",
29
+ "-apple-system",
30
+ "Segoe UI",
31
+ "Roboto",
32
+ "Noto Sans Arabic",
33
+ "Noto Sans Hebrew",
34
+ "Noto Sans Devanagari",
35
+ "Noto Sans Bengali",
36
+ "Noto Sans Tamil",
37
+ "Noto Sans Thai",
38
+ "Noto Sans Ethiopic",
39
+ "Noto Sans Armenian",
40
+ "Noto Sans Georgian",
41
+ "Noto Sans JP",
42
+ "Noto Sans SC",
43
+ "Noto Sans KR",
44
+ "sans-serif"
45
+ ],
46
+ "$description": "Everything but headings. Latin, Cyrillic and Greek from Plex/Noto Sans; per-glyph fallback to the Noto family of each script; :lang() overrides reorder CJK and adapt other scripts."
47
+ },
48
+ "mono": {
49
+ "$value": [
50
+ "IBM Plex Mono",
51
+ "Noto Sans Mono",
52
+ "ui-monospace",
53
+ "SFMono-Regular",
54
+ "Menlo",
55
+ "monospace"
56
+ ],
57
+ "$description": "Identifiers, hashes, keys, versions only."
58
+ }
59
+ },
60
+ "weight": {
61
+ "$type": "fontWeight",
62
+ "regular": {
63
+ "$value": 400
64
+ },
65
+ "semibold": {
66
+ "$value": 600
67
+ },
68
+ "bold": {
69
+ "$value": 700
70
+ }
71
+ },
72
+ "size": {
73
+ "$type": "dimension",
74
+ "display": {
75
+ "$value": {
76
+ "value": 36,
77
+ "unit": "px"
78
+ }
79
+ },
80
+ "h1": {
81
+ "$value": {
82
+ "value": 30,
83
+ "unit": "px"
84
+ }
85
+ },
86
+ "h1-narrow": {
87
+ "$value": {
88
+ "value": 24,
89
+ "unit": "px"
90
+ }
91
+ },
92
+ "h2": {
93
+ "$value": {
94
+ "value": 22,
95
+ "unit": "px"
96
+ }
97
+ },
98
+ "h3": {
99
+ "$value": {
100
+ "value": 18,
101
+ "unit": "px"
102
+ }
103
+ },
104
+ "body-lg": {
105
+ "$value": {
106
+ "value": 16,
107
+ "unit": "px"
108
+ }
109
+ },
110
+ "body": {
111
+ "$value": {
112
+ "value": 14,
113
+ "unit": "px"
114
+ }
115
+ },
116
+ "label": {
117
+ "$value": {
118
+ "value": 13,
119
+ "unit": "px"
120
+ }
121
+ },
122
+ "meta": {
123
+ "$value": {
124
+ "value": 12,
125
+ "unit": "px"
126
+ }
127
+ },
128
+ "eyebrow": {
129
+ "$value": {
130
+ "value": 12,
131
+ "unit": "px"
132
+ }
133
+ }
134
+ },
135
+ "line-height": {
136
+ "$type": "dimension",
137
+ "display": {
138
+ "$value": {
139
+ "value": 44,
140
+ "unit": "px"
141
+ }
142
+ },
143
+ "h1": {
144
+ "$value": {
145
+ "value": 38,
146
+ "unit": "px"
147
+ }
148
+ },
149
+ "h1-narrow": {
150
+ "$value": {
151
+ "value": 32,
152
+ "unit": "px"
153
+ }
154
+ },
155
+ "h2": {
156
+ "$value": {
157
+ "value": 30,
158
+ "unit": "px"
159
+ }
160
+ },
161
+ "h3": {
162
+ "$value": {
163
+ "value": 26,
164
+ "unit": "px"
165
+ }
166
+ },
167
+ "body-lg": {
168
+ "$value": {
169
+ "value": 26,
170
+ "unit": "px"
171
+ }
172
+ },
173
+ "body": {
174
+ "$value": {
175
+ "value": 22,
176
+ "unit": "px"
177
+ }
178
+ },
179
+ "label": {
180
+ "$value": {
181
+ "value": 18,
182
+ "unit": "px"
183
+ }
184
+ },
185
+ "meta": {
186
+ "$value": {
187
+ "value": 18,
188
+ "unit": "px"
189
+ }
190
+ },
191
+ "eyebrow": {
192
+ "$value": {
193
+ "value": 16,
194
+ "unit": "px"
195
+ }
196
+ }
197
+ },
198
+ "tracking": {
199
+ "$type": "dimension",
200
+ "h1": {
201
+ "$value": {
202
+ "value": -0.01,
203
+ "unit": "rem"
204
+ },
205
+ "$description": "-0.01em per §2.2; stored in rem for DTCG, emitted as em."
206
+ },
207
+ "eyebrow": {
208
+ "$value": {
209
+ "value": 0.08,
210
+ "unit": "rem"
211
+ },
212
+ "$description": "0.08em per §2.2; stored in rem for DTCG, emitted as em."
213
+ }
214
+ }
215
+ },
216
+ "measure": {
217
+ "$type": "number",
218
+ "prose": {
219
+ "$value": 68,
220
+ "$description": "Prose max width in ch."
221
+ },
222
+ "summary": {
223
+ "$value": 60,
224
+ "$description": "Reading summary max width in ch."
225
+ }
226
+ }
227
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$description": "Stacking order. Not in the design direction; chosen by the implementer.",
3
+ "z": {
4
+ "$type": "number",
5
+ "base": { "$value": 0 },
6
+ "sticky": { "$value": 100 },
7
+ "nav-drawer": { "$value": 400 },
8
+ "modal": { "$value": 500 },
9
+ "popover": { "$value": 600 },
10
+ "toast": { "$value": 700 },
11
+ "skip-link": { "$value": 800 }
12
+ }
13
+ }
package/src/color.ts ADDED
@@ -0,0 +1,239 @@
1
+ // Colour math for the theme generator: sRGB <-> OKLab <-> OKLCH (from Björn
2
+ // Ottosson's published OKLab definition), gamut mapping by chroma reduction,
3
+ // alpha compositing, WCAG 2 contrast ratio and APCA lightness contrast
4
+ // (informational only). Pure and deterministic; no dependencies.
5
+
6
+ /** Straight (non-premultiplied) sRGB colour, channels 0..1. */
7
+ export interface Rgba {
8
+ r: number
9
+ g: number
10
+ b: number
11
+ a: number
12
+ }
13
+
14
+ export interface Oklch {
15
+ l: number
16
+ c: number
17
+ h: number
18
+ }
19
+
20
+ const clamp01 = (v: number) => Math.min(1, Math.max(0, v))
21
+
22
+ function toLinear(c: number): number {
23
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
24
+ }
25
+
26
+ function fromLinear(c: number): number {
27
+ return c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055
28
+ }
29
+
30
+ export function rgbToOklab({ r, g, b }: Rgba): { L: number; a: number; b: number } {
31
+ const lr = toLinear(r)
32
+ const lg = toLinear(g)
33
+ const lb = toLinear(b)
34
+ const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb)
35
+ const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb)
36
+ const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb)
37
+ return {
38
+ L: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
39
+ a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
40
+ b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
41
+ }
42
+ }
43
+
44
+ /** OKLab to linear-light sRGB (may be out of gamut). */
45
+ function oklabToLinear(L: number, a: number, b: number): [number, number, number] {
46
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3
47
+ const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3
48
+ const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3
49
+ return [
50
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
51
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
52
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
53
+ ]
54
+ }
55
+
56
+ export function rgbToOklch(c: Rgba): Oklch {
57
+ const { L, a, b } = rgbToOklab(c)
58
+ const chroma = Math.hypot(a, b)
59
+ let h = (Math.atan2(b, a) * 180) / Math.PI
60
+ if (h < 0) h += 360
61
+ return { l: L, c: chroma, h: chroma < 1e-6 ? 0 : h }
62
+ }
63
+
64
+ function inGamut(lin: [number, number, number]): boolean {
65
+ const eps = 1e-6
66
+ return lin.every((v) => v >= -eps && v <= 1 + eps)
67
+ }
68
+
69
+ /**
70
+ * OKLCH to sRGB. Out-of-gamut colours keep lightness and hue and lose chroma
71
+ * (binary search), which preserves the perceived tone of a ramp step.
72
+ */
73
+ export function oklchToRgb({ l, c, h }: Oklch, alpha = 1): Rgba {
74
+ const L = clamp01(l)
75
+ const rad = (h * Math.PI) / 180
76
+ const lin = (chroma: number) => oklabToLinear(L, chroma * Math.cos(rad), chroma * Math.sin(rad))
77
+ let chroma = Math.max(0, c)
78
+ if (!inGamut(lin(chroma))) {
79
+ let lo = 0
80
+ let hi = chroma
81
+ for (let i = 0; i < 32; i++) {
82
+ const mid = (lo + hi) / 2
83
+ if (inGamut(lin(mid))) lo = mid
84
+ else hi = mid
85
+ }
86
+ chroma = lo
87
+ }
88
+ // Quantised to 8 bits per channel so every serialisation (hex, DTCG
89
+ // components, rgb()) round-trips to the same value.
90
+ const [r, g, b] = lin(chroma).map((v) => Math.round(clamp01(fromLinear(clamp01(v))) * 255) / 255) as [number, number, number]
91
+ return { r, g, b, a: alpha }
92
+ }
93
+
94
+ const hex2 = (v: number) =>
95
+ Math.round(clamp01(v) * 255)
96
+ .toString(16)
97
+ .padStart(2, '0')
98
+
99
+ /** `#rrggbb` (alpha ignored). */
100
+ export function toHex(c: Rgba): string {
101
+ return `#${hex2(c.r)}${hex2(c.g)}${hex2(c.b)}`
102
+ }
103
+
104
+ /** CSS serialisation: hex when opaque, `rgb(r g b / a)` otherwise. */
105
+ export function toCss(c: Rgba): string {
106
+ if (c.a >= 1) return toHex(c)
107
+ const ch = (v: number) => Math.round(clamp01(v) * 255)
108
+ return `rgb(${ch(c.r)} ${ch(c.g)} ${ch(c.b)} / ${Math.round(c.a * 1000) / 1000})`
109
+ }
110
+
111
+ /** Parses `#rgb`, `#rrggbb`, `#rrggbbaa`, `rgb(r g b / a)` and `rgba(r, g, b, a)`. */
112
+ export function parseColor(input: string): Rgba {
113
+ const s = input.trim().toLowerCase()
114
+ if (s.startsWith('#')) {
115
+ let h = s.slice(1)
116
+ if (h.length === 3) h = [...h].map((x) => x + x).join('')
117
+ if (h.length !== 6 && h.length !== 8) throw new Error(`Invalid colour ${input}`)
118
+ const n = (i: number) => parseInt(h.slice(i, i + 2), 16) / 255
119
+ return { r: n(0), g: n(2), b: n(4), a: h.length === 8 ? n(6) : 1 }
120
+ }
121
+ const m = /^rgba?\(([^)]+)\)$/.exec(s)
122
+ if (m && m[1]) {
123
+ const parts = m[1].split(/[\s,/]+/).filter(Boolean).map(Number)
124
+ const [r = 0, g = 0, b = 0, a = 1] = parts
125
+ return { r: r / 255, g: g / 255, b: b / 255, a }
126
+ }
127
+ throw new Error(`Unsupported colour ${input}`)
128
+ }
129
+
130
+ /** Source-over compositing of `top` onto `bottom`. */
131
+ export function composite(top: Rgba, bottom: Rgba): Rgba {
132
+ const a = top.a + bottom.a * (1 - top.a)
133
+ if (a === 0) return { r: 0, g: 0, b: 0, a: 0 }
134
+ const mix = (t: number, b: number) => (t * top.a + b * bottom.a * (1 - top.a)) / a
135
+ return { r: mix(top.r, bottom.r), g: mix(top.g, bottom.g), b: mix(top.b, bottom.b), a }
136
+ }
137
+
138
+ /** Composites a stack given from top to bottom; the last layer should be opaque. */
139
+ export function flatten(stack: Rgba[]): Rgba {
140
+ return stack.reduceRight<Rgba | null>((acc, layer) => (acc ? composite(layer, acc) : layer), null) ?? { r: 1, g: 1, b: 1, a: 1 }
141
+ }
142
+
143
+ /** WCAG 2.x relative luminance. */
144
+ export function luminance(c: Rgba): number {
145
+ return 0.2126 * toLinear(c.r) + 0.7152 * toLinear(c.g) + 0.0722 * toLinear(c.b)
146
+ }
147
+
148
+ /** WCAG 2.x contrast ratio (1..21) between two opaque colours. */
149
+ export function contrastRatio(a: Rgba, b: Rgba): number {
150
+ const la = luminance(a)
151
+ const lb = luminance(b)
152
+ const [hi, lo] = la > lb ? [la, lb] : [lb, la]
153
+ return (hi + 0.05) / (lo + 0.05)
154
+ }
155
+
156
+ /**
157
+ * APCA lightness contrast Lc (text on background), implemented from the
158
+ * public description of the APCA-W3 0.0.98G constants. Informational only:
159
+ * WCAG 2.2 conformance is decided by `contrastRatio`.
160
+ */
161
+ export function apcaContrast(text: Rgba, background: Rgba): number {
162
+ const y = (c: Rgba) => 0.2126729 * c.r ** 2.4 + 0.7151522 * c.g ** 2.4 + 0.072175 * c.b ** 2.4
163
+ const clampBlack = (v: number) => (v > 0.022 ? v : v + (0.022 - v) ** 1.414)
164
+ const yt = clampBlack(y(text))
165
+ const yb = clampBlack(y(background))
166
+ if (Math.abs(yb - yt) < 0.0005) return 0
167
+ if (yb > yt) {
168
+ const sapc = (yb ** 0.56 - yt ** 0.57) * 1.14
169
+ return sapc < 0.1 ? 0 : (sapc - 0.027) * 100
170
+ }
171
+ const sapc = (yb ** 0.65 - yt ** 0.62) * 1.14
172
+ return sapc > -0.1 ? 0 : (sapc + 0.027) * 100
173
+ }
174
+
175
+ /** CIE L*a*b* (D65) from sRGB, via CIE XYZ. */
176
+ export function rgbToLab({ r, g, b }: Rgba): { L: number; a: number; b: number } {
177
+ const lr = toLinear(r)
178
+ const lg = toLinear(g)
179
+ const lb = toLinear(b)
180
+ const x = (0.4124564 * lr + 0.3575761 * lg + 0.1804375 * lb) / 0.95047
181
+ const y = 0.2126729 * lr + 0.7151522 * lg + 0.072175 * lb
182
+ const z = (0.0193339 * lr + 0.119192 * lg + 0.9503041 * lb) / 1.08883
183
+ const f = (t: number) => (t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116)
184
+ const fx = f(x)
185
+ const fy = f(y)
186
+ const fz = f(z)
187
+ return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) }
188
+ }
189
+
190
+ /**
191
+ * CIEDE2000 colour difference (ΔE00) between two opaque colours, implemented
192
+ * from the published formula (Sharma, Wu and Dalal, 2005). About 1 is a just
193
+ * noticeable difference; 10 or more reads as clearly different colours.
194
+ */
195
+ export function deltaE2000(c1: Rgba, c2: Rgba): number {
196
+ const { L: L1, a: a1, b: b1 } = rgbToLab(c1)
197
+ const { L: L2, a: a2, b: b2 } = rgbToLab(c2)
198
+ const rad = Math.PI / 180
199
+ const C1 = Math.hypot(a1, b1)
200
+ const C2 = Math.hypot(a2, b2)
201
+ const Cm = (C1 + C2) / 2
202
+ const G = 0.5 * (1 - Math.sqrt(Cm ** 7 / (Cm ** 7 + 25 ** 7)))
203
+ const a1p = (1 + G) * a1
204
+ const a2p = (1 + G) * a2
205
+ const C1p = Math.hypot(a1p, b1)
206
+ const C2p = Math.hypot(a2p, b2)
207
+ const hp = (a: number, b: number) => {
208
+ if (a === 0 && b === 0) return 0
209
+ const h = Math.atan2(b, a) / rad
210
+ return h < 0 ? h + 360 : h
211
+ }
212
+ const h1p = hp(a1p, b1)
213
+ const h2p = hp(a2p, b2)
214
+ const dLp = L2 - L1
215
+ const dCp = C2p - C1p
216
+ let dhp = 0
217
+ if (C1p * C2p !== 0) {
218
+ dhp = h2p - h1p
219
+ if (dhp > 180) dhp -= 360
220
+ else if (dhp < -180) dhp += 360
221
+ }
222
+ const dHp = 2 * Math.sqrt(C1p * C2p) * Math.sin((dhp / 2) * rad)
223
+ const Lmp = (L1 + L2) / 2
224
+ const Cmp = (C1p + C2p) / 2
225
+ let hmp = h1p + h2p
226
+ if (C1p * C2p !== 0) {
227
+ if (Math.abs(h1p - h2p) <= 180) hmp = (h1p + h2p) / 2
228
+ else hmp = h1p + h2p < 360 ? (h1p + h2p + 360) / 2 : (h1p + h2p - 360) / 2
229
+ }
230
+ const T =
231
+ 1 - 0.17 * Math.cos((hmp - 30) * rad) + 0.24 * Math.cos(2 * hmp * rad) + 0.32 * Math.cos((3 * hmp + 6) * rad) - 0.2 * Math.cos((4 * hmp - 63) * rad)
232
+ const dTheta = 30 * Math.exp(-(((hmp - 275) / 25) ** 2))
233
+ const Rc = 2 * Math.sqrt(Cmp ** 7 / (Cmp ** 7 + 25 ** 7))
234
+ const Sl = 1 + (0.015 * (Lmp - 50) ** 2) / Math.sqrt(20 + (Lmp - 50) ** 2)
235
+ const Sc = 1 + 0.045 * Cmp
236
+ const Sh = 1 + 0.015 * Cmp * T
237
+ const Rt = -Math.sin(2 * dTheta * rad) * Rc
238
+ return Math.sqrt((dLp / Sl) ** 2 + (dCp / Sc) ** 2 + (dHp / Sh) ** 2 + Rt * (dCp / Sc) * (dHp / Sh))
239
+ }