@trishchuk/coolors-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/.claude/settings.local.json +39 -0
  2. package/.env +2 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +73 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +71 -0
  5. package/.github/pull_request_template.md +97 -0
  6. package/.github/workflows/ci.yml +127 -0
  7. package/.github/workflows/deploy-docs.yml +56 -0
  8. package/.github/workflows/release.yml +99 -0
  9. package/.mcp.json +12 -0
  10. package/.prettierignore +1 -0
  11. package/CLAUDE.md +201 -0
  12. package/DOCUMENTATION.md +274 -0
  13. package/GEMINI.md +54 -0
  14. package/LICENSE +21 -0
  15. package/README.md +401 -0
  16. package/demo/content_based_color.png +0 -0
  17. package/demo/music-player.html +621 -0
  18. package/demo/podcast-player.html +903 -0
  19. package/dist/bin/coolors-mcp.d.ts +1 -0
  20. package/dist/bin/coolors-mcp.js +154 -0
  21. package/dist/bin/coolors-mcp.js.map +1 -0
  22. package/dist/bin/server.d.ts +1 -0
  23. package/dist/bin/server.js +3292 -0
  24. package/dist/bin/server.js.map +1 -0
  25. package/dist/chunk-IQ7NN26V.js +114 -0
  26. package/dist/chunk-IQ7NN26V.js.map +1 -0
  27. package/dist/chunk-P3ARRKLS.js +1214 -0
  28. package/dist/chunk-P3ARRKLS.js.map +1 -0
  29. package/dist/color/index.d.ts +716 -0
  30. package/dist/color/index.js +153 -0
  31. package/dist/color/index.js.map +1 -0
  32. package/dist/coolors-mcp.d.ts +136 -0
  33. package/dist/coolors-mcp.js +7 -0
  34. package/dist/coolors-mcp.js.map +1 -0
  35. package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
  36. package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
  37. package/docs/.vitepress/cache/deps/_metadata.json +127 -0
  38. package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
  39. package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
  40. package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +12683 -0
  41. package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js.map +7 -0
  42. package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +9719 -0
  43. package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js.map +7 -0
  44. package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
  45. package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
  46. package/docs/.vitepress/cache/deps/cytoscape.js +30278 -0
  47. package/docs/.vitepress/cache/deps/cytoscape.js.map +7 -0
  48. package/docs/.vitepress/cache/deps/dayjs.js +285 -0
  49. package/docs/.vitepress/cache/deps/dayjs.js.map +7 -0
  50. package/docs/.vitepress/cache/deps/debug.js +468 -0
  51. package/docs/.vitepress/cache/deps/debug.js.map +7 -0
  52. package/docs/.vitepress/cache/deps/package.json +3 -0
  53. package/docs/.vitepress/cache/deps/prismjs.js +1466 -0
  54. package/docs/.vitepress/cache/deps/prismjs.js.map +7 -0
  55. package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +228 -0
  56. package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js.map +7 -0
  57. package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +142 -0
  58. package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js.map +7 -0
  59. package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +27 -0
  60. package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js.map +7 -0
  61. package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +65 -0
  62. package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js.map +7 -0
  63. package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +53 -0
  64. package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js.map +7 -0
  65. package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +73 -0
  66. package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js.map +7 -0
  67. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
  68. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  69. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
  70. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  71. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1146 -0
  72. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  73. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
  74. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  75. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1814 -0
  76. package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  77. package/docs/.vitepress/cache/deps/vue.js +344 -0
  78. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  79. package/docs/.vitepress/components/ClientGrid.vue +125 -0
  80. package/docs/.vitepress/components/CodeBlock.vue +231 -0
  81. package/docs/.vitepress/components/ConfigModal.vue +477 -0
  82. package/docs/.vitepress/components/DiagramModal.vue +528 -0
  83. package/docs/.vitepress/components/TroubleshootingModal.vue +472 -0
  84. package/docs/.vitepress/config.js +162 -0
  85. package/docs/.vitepress/theme/FundingLayout.vue +251 -0
  86. package/docs/.vitepress/theme/Layout.vue +134 -0
  87. package/docs/.vitepress/theme/components/AdBanner.vue +317 -0
  88. package/docs/.vitepress/theme/components/AdPlaceholder.vue +78 -0
  89. package/docs/.vitepress/theme/components/FundingEffects.vue +322 -0
  90. package/docs/.vitepress/theme/components/FundingHero.vue +345 -0
  91. package/docs/.vitepress/theme/components/SupportSection.vue +511 -0
  92. package/docs/.vitepress/theme/custom-app.css +339 -0
  93. package/docs/.vitepress/theme/custom.css +699 -0
  94. package/docs/.vitepress/theme/index.js +25 -0
  95. package/docs/README.md +198 -0
  96. package/docs/concepts/accessibility.md +473 -0
  97. package/docs/concepts/color-spaces.md +222 -0
  98. package/docs/concepts/distance-metrics.md +384 -0
  99. package/docs/concepts/hct.md +261 -0
  100. package/docs/concepts/image-analysis.md +396 -0
  101. package/docs/concepts/material-design.md +306 -0
  102. package/docs/concepts/theme-matching.md +399 -0
  103. package/docs/examples/basic-colors.md +490 -0
  104. package/docs/examples/creating-themes.md +898 -0
  105. package/docs/examples/css-refactoring.md +824 -0
  106. package/docs/examples/image-extraction.md +882 -0
  107. package/docs/getting-started.md +366 -0
  108. package/docs/index.md +190 -0
  109. package/docs/installation.md +157 -0
  110. package/docs/tools/README.md +234 -0
  111. package/docs/tools/accessibility.md +614 -0
  112. package/docs/tools/color-operations.md +374 -0
  113. package/docs/tools/image-extraction.md +624 -0
  114. package/docs/tools/material-design.md +347 -0
  115. package/docs/tools/theme-matching.md +552 -0
  116. package/eslint.config.ts +14 -0
  117. package/examples/theme-matching.md +113 -0
  118. package/jsr.json +7 -0
  119. package/mcp-config.json +8 -0
  120. package/note.md +35 -0
  121. package/package.json +122 -0
  122. package/research_results.md +53 -0
  123. package/src/bin/coolors-mcp.ts +194 -0
  124. package/src/bin/server.ts +61 -0
  125. package/src/color/__tests__/conversions-argb.test.ts +198 -0
  126. package/src/color/__tests__/extract-colors.test.ts +360 -0
  127. package/src/color/__tests__/image-utils.test.ts +242 -0
  128. package/src/color/__tests__/reference-colors.test.ts +278 -0
  129. package/src/color/__tests__/round-trip.test.ts +197 -0
  130. package/src/color/conversions.test.ts +402 -0
  131. package/src/color/conversions.ts +393 -0
  132. package/src/color/dislike/__tests__/dislike-analyzer.test.ts +248 -0
  133. package/src/color/dislike/dislike-analyzer.ts +114 -0
  134. package/src/color/extract-colors.ts +228 -0
  135. package/src/color/hct/__tests__/hct-class.test.ts +232 -0
  136. package/src/color/hct/harmonization.ts +204 -0
  137. package/src/color/hct/hct-class.ts +109 -0
  138. package/src/color/hct/hct-solver.ts +168 -0
  139. package/src/color/hct/index.ts +39 -0
  140. package/src/color/hct/tonal-palette.ts +211 -0
  141. package/src/color/hct/types.ts +88 -0
  142. package/src/color/image-utils.ts +79 -0
  143. package/src/color/index.ts +87 -0
  144. package/src/color/material-theme.ts +157 -0
  145. package/src/color/metrics.test.ts +276 -0
  146. package/src/color/metrics.ts +281 -0
  147. package/src/color/quantize/__tests__/quantizer_celebi.test.ts +195 -0
  148. package/src/color/quantize/lab_point_provider.ts +55 -0
  149. package/src/color/quantize/point_provider.ts +27 -0
  150. package/src/color/quantize/quantizer_celebi.ts +51 -0
  151. package/src/color/quantize/quantizer_celebi_test.ts +71 -0
  152. package/src/color/quantize/quantizer_map.ts +47 -0
  153. package/src/color/quantize/quantizer_wsmeans.ts +232 -0
  154. package/src/color/quantize/quantizer_wu.ts +472 -0
  155. package/src/color/score/__tests__/score.test.ts +224 -0
  156. package/src/color/score/score.ts +175 -0
  157. package/src/color/types.ts +151 -0
  158. package/src/color/utils/color_utils.ts +292 -0
  159. package/src/color/utils/math_utils.ts +145 -0
  160. package/src/color/utils.test.ts +403 -0
  161. package/src/color/utils.ts +315 -0
  162. package/src/constants.ts +5 -0
  163. package/src/coolors-mcp.ts +37 -0
  164. package/src/examples/addition.ts +333 -0
  165. package/src/examples/color-demo.ts +125 -0
  166. package/src/examples/custom-logger.ts +201 -0
  167. package/src/examples/oauth-server.ts +113 -0
  168. package/src/examples/session-context.ts +269 -0
  169. package/src/session.ts +116 -0
  170. package/src/theme/__tests__/matcher.test.ts +180 -0
  171. package/src/theme/__tests__/parser.test.ts +148 -0
  172. package/src/theme/__tests__/refactor.test.ts +224 -0
  173. package/src/theme/index.ts +34 -0
  174. package/src/theme/matcher.ts +395 -0
  175. package/src/theme/parser.ts +392 -0
  176. package/src/theme/refactor.ts +360 -0
  177. package/src/theme/types.ts +152 -0
  178. package/src/tools/__tests__/gradient-generator.test.ts +206 -0
  179. package/src/tools/__tests__/palette-with-locks.test.ts +109 -0
  180. package/src/tools/color-conversion.tool.ts +54 -0
  181. package/src/tools/color-distance.tool.ts +41 -0
  182. package/src/tools/colors.ts +31 -0
  183. package/src/tools/contrast-checker.tool.ts +37 -0
  184. package/src/tools/dislike-analyzer.tool.ts +247 -0
  185. package/src/tools/gradient-generator.tool.ts +250 -0
  186. package/src/tools/image-extraction.tools.ts +289 -0
  187. package/src/tools/index.ts +39 -0
  188. package/src/tools/material-theme.tools.ts +250 -0
  189. package/src/tools/palette-generator.tool.ts +135 -0
  190. package/src/tools/palette-with-locks.tool.ts +221 -0
  191. package/src/tools/registry.ts +142 -0
  192. package/src/tools/simple-tools.ts +37 -0
  193. package/src/tools/theme-matching.tools.ts +334 -0
  194. package/src/types.ts +182 -0
  195. package/src/utils.ts +22 -0
  196. package/tsconfig.json +8 -0
  197. package/vitest.config.js +15 -0
@@ -0,0 +1,374 @@
1
+ # Color Operations Tools
2
+
3
+ Tools for fundamental color manipulation, conversion, and analysis.
4
+
5
+ ## Tools
6
+
7
+ ### `convert_color`
8
+
9
+ Convert colors between different format representations.
10
+
11
+ #### Parameters
12
+
13
+ | Parameter | Type | Required | Default | Description |
14
+ | --------- | ------ | -------- | ------- | ------------------------------------------------ |
15
+ | `color` | string | Yes | - | Input color (hex, rgb, hsl) |
16
+ | `to` | enum | Yes | - | Target format: "hex", "rgb", "hsl", "lab", "hct" |
17
+
18
+ #### Returns
19
+
20
+ String containing the color in the requested format.
21
+
22
+ #### Examples
23
+
24
+ ```typescript
25
+ // Hex to RGB
26
+ {
27
+ "color": "#6750a4",
28
+ "to": "rgb"
29
+ }
30
+ // Returns: "rgb(103, 80, 164)"
31
+
32
+ // RGB to HCT
33
+ {
34
+ "color": "rgb(103, 80, 164)",
35
+ "to": "hct"
36
+ }
37
+ // Returns: "hct(258.1, 47.3, 41.2)"
38
+
39
+ // HSL to LAB
40
+ {
41
+ "color": "hsl(258, 35%, 48%)",
42
+ "to": "lab"
43
+ }
44
+ // Returns: "lab(39.4, 31.2, -42.8)"
45
+ ```
46
+
47
+ #### Use Cases
48
+
49
+ - Converting design tool colors to CSS formats
50
+ - Preparing colors for perceptual calculations
51
+ - Migrating between color systems
52
+ - Ensuring format compatibility across tools
53
+
54
+ ---
55
+
56
+ ### `color_distance`
57
+
58
+ Calculate the perceptual difference between two colors using various metrics.
59
+
60
+ #### Parameters
61
+
62
+ | Parameter | Type | Required | Default | Description |
63
+ | --------- | ------ | -------- | ------------ | ------------------------------------------------------------------------------ |
64
+ | `color1` | string | Yes | - | First color |
65
+ | `color2` | string | Yes | - | Second color |
66
+ | `metric` | enum | No | "deltaE2000" | Distance metric: "euclidean", "deltaE76", "deltaE94", "deltaE2000", "weighted" |
67
+
68
+ #### Returns
69
+
70
+ Number representing the perceptual distance between colors.
71
+
72
+ #### Distance Metrics Explained
73
+
74
+ - **euclidean**: Simple RGB distance, fast but not perceptually accurate
75
+ - **deltaE76**: CIE 1976 standard, basic perceptual difference
76
+ - **deltaE94**: Improved for graphics arts applications
77
+ - **deltaE2000**: Most accurate perceptual metric, recommended for most uses
78
+ - **weighted**: Custom weighting for specific use cases
79
+
80
+ #### Interpreting Results
81
+
82
+ | Delta E Value | Perception |
83
+ | ------------- | ------------------------------------- |
84
+ | < 1.0 | Not perceptible by human eyes |
85
+ | 1-2 | Perceptible through close observation |
86
+ | 2-10 | Perceptible at a glance |
87
+ | 10-50 | Colors are more similar than opposite |
88
+ | > 50 | Colors are more opposite than similar |
89
+
90
+ #### Examples
91
+
92
+ ```typescript
93
+ // Compare similar colors
94
+ {
95
+ "color1": "#6750a4",
96
+ "color2": "#6751a5",
97
+ "metric": "deltaE2000"
98
+ }
99
+ // Returns: 0.34 (imperceptible difference)
100
+
101
+ // Compare different colors
102
+ {
103
+ "color1": "#ff0000",
104
+ "color2": "#00ff00",
105
+ "metric": "deltaE2000"
106
+ }
107
+ // Returns: 86.61 (very different)
108
+
109
+ // Quick RGB comparison
110
+ {
111
+ "color1": "rgb(100, 100, 100)",
112
+ "color2": "rgb(110, 110, 110)",
113
+ "metric": "euclidean"
114
+ }
115
+ // Returns: 17.32
116
+ ```
117
+
118
+ #### Use Cases
119
+
120
+ - Determining if colors are visually distinct
121
+ - Finding similar colors in a palette
122
+ - Quality control for color reproduction
123
+ - Grouping colors by similarity
124
+
125
+ ---
126
+
127
+ ### `check_contrast`
128
+
129
+ Check WCAG contrast ratio between foreground and background colors.
130
+
131
+ #### Parameters
132
+
133
+ | Parameter | Type | Required | Default | Description |
134
+ | ------------ | ------ | -------- | ------- | --------------------- |
135
+ | `foreground` | string | Yes | - | Text/foreground color |
136
+ | `background` | string | Yes | - | Background color |
137
+
138
+ #### Returns
139
+
140
+ Object containing contrast ratio and WCAG compliance levels.
141
+
142
+ ```typescript
143
+ {
144
+ "ratio": 21.0,
145
+ "aa": {
146
+ "normal": true,
147
+ "large": true
148
+ },
149
+ "aaa": {
150
+ "normal": true,
151
+ "large": true
152
+ }
153
+ }
154
+ ```
155
+
156
+ #### WCAG Standards
157
+
158
+ | Level | Normal Text | Large Text |
159
+ | ----- | ----------- | ---------- |
160
+ | AA | 4.5:1 | 3:1 |
161
+ | AAA | 7:1 | 4.5:1 |
162
+
163
+ Large text is defined as:
164
+
165
+ - 18pt (24px) or larger
166
+ - 14pt (18.66px) or larger if bold
167
+
168
+ #### Examples
169
+
170
+ ```typescript
171
+ // High contrast (black on white)
172
+ {
173
+ "foreground": "#000000",
174
+ "background": "#ffffff"
175
+ }
176
+ // Returns:
177
+ // Ratio: 21:1
178
+ // AA: ✓ Pass (normal & large)
179
+ // AAA: ✓ Pass (normal & large)
180
+
181
+ // Medium contrast
182
+ {
183
+ "foreground": "#6750a4",
184
+ "background": "#ffffff"
185
+ }
186
+ // Returns:
187
+ // Ratio: 6.23:1
188
+ // AA: ✓ Pass (normal & large)
189
+ // AAA: ✗ Fail (normal), ✓ Pass (large)
190
+
191
+ // Low contrast
192
+ {
193
+ "foreground": "#aaaaaa",
194
+ "background": "#ffffff"
195
+ }
196
+ // Returns:
197
+ // Ratio: 2.32:1
198
+ // AA: ✗ Fail (normal), ✗ Fail (large)
199
+ // AAA: ✗ Fail (normal & large)
200
+ ```
201
+
202
+ #### Use Cases
203
+
204
+ - Ensuring web accessibility compliance
205
+ - Validating design system colors
206
+ - Finding accessible color combinations
207
+ - Automated accessibility testing
208
+
209
+ ---
210
+
211
+ ### `generate_palette`
212
+
213
+ Generate harmonious color palettes from a base color.
214
+
215
+ #### Parameters
216
+
217
+ | Parameter | Type | Required | Default | Description |
218
+ | ----------- | ------ | -------- | --------------- | ---------------------------------------------------------------------------------- |
219
+ | `baseColor` | string | Yes | - | Starting color for palette |
220
+ | `type` | enum | No | "monochromatic" | Palette type: "monochromatic", "analogous", "complementary", "triadic", "tetradic" |
221
+ | `count` | number | No | 5 | Number of colors (3-10) |
222
+
223
+ #### Palette Types Explained
224
+
225
+ - **monochromatic**: Variations of a single hue with different saturation/lightness
226
+ - **analogous**: Adjacent colors on the color wheel (harmonious)
227
+ - **complementary**: Opposite colors on the wheel (high contrast)
228
+ - **triadic**: Three evenly spaced colors (balanced contrast)
229
+ - **tetradic**: Four colors in complementary pairs (rich schemes)
230
+
231
+ #### Returns
232
+
233
+ Array of color strings in hex format.
234
+
235
+ #### Examples
236
+
237
+ ```typescript
238
+ // Monochromatic palette
239
+ {
240
+ "baseColor": "#6750a4",
241
+ "type": "monochromatic",
242
+ "count": 5
243
+ }
244
+ // Returns: ["#2a2042", "#4a3872", "#6750a4", "#9580c4", "#c4b8e4"]
245
+
246
+ // Analogous palette
247
+ {
248
+ "baseColor": "#3498db",
249
+ "type": "analogous",
250
+ "count": 5
251
+ }
252
+ // Returns: ["#34d8db", "#34b8db", "#3498db", "#3478db", "#3458db"]
253
+
254
+ // Complementary palette
255
+ {
256
+ "baseColor": "#ff6b6b",
257
+ "type": "complementary",
258
+ "count": 2
259
+ }
260
+ // Returns: ["#ff6b6b", "#6bffc9"]
261
+
262
+ // Triadic palette
263
+ {
264
+ "baseColor": "#e74c3c",
265
+ "type": "triadic",
266
+ "count": 3
267
+ }
268
+ // Returns: ["#e74c3c", "#3ce74c", "#4c3ce7"]
269
+ ```
270
+
271
+ #### Use Cases
272
+
273
+ - Creating brand color palettes
274
+ - Generating UI color schemes
275
+ - Finding harmonious color combinations
276
+ - Exploring color variations
277
+
278
+ ## Common Patterns
279
+
280
+ ### Color Input Formats
281
+
282
+ All color parameters accept:
283
+
284
+ - **Hex**: `#rgb`, `#rrggbb` (with or without #)
285
+ - **RGB**: `rgb(r, g, b)` where values are 0-255
286
+ - **HSL**: `hsl(h, s%, l%)` where h is 0-360, s and l are 0-100
287
+
288
+ ### Error Handling
289
+
290
+ Invalid colors return descriptive errors:
291
+
292
+ ```
293
+ "Error: Invalid color format: xyz123"
294
+ "Error: Color values out of range"
295
+ ```
296
+
297
+ ### Performance Considerations
298
+
299
+ - `convert_color`: O(1) - Direct calculation
300
+ - `color_distance`: O(1) - Direct calculation
301
+ - `check_contrast`: O(1) - Direct calculation
302
+ - `generate_palette`: O(n) - Linear with count
303
+
304
+ ## Integration Examples
305
+
306
+ ### Accessibility Checker
307
+
308
+ ```typescript
309
+ async function checkAccessibility(colors) {
310
+ const results = [];
311
+ for (const fg of colors.foregrounds) {
312
+ for (const bg of colors.backgrounds) {
313
+ const contrast = await checkContrast(fg, bg);
314
+ if (contrast.aa.normal) {
315
+ results.push({ fg, bg, ratio: contrast.ratio });
316
+ }
317
+ }
318
+ }
319
+ return results;
320
+ }
321
+ ```
322
+
323
+ ### Palette Generator
324
+
325
+ ```typescript
326
+ async function createBrandPalette(brandColor) {
327
+ const monochromatic = await generatePalette({
328
+ baseColor: brandColor,
329
+ type: "monochromatic",
330
+ count: 5,
331
+ });
332
+
333
+ const accent = await generatePalette({
334
+ baseColor: brandColor,
335
+ type: "complementary",
336
+ count: 2,
337
+ });
338
+
339
+ return {
340
+ primary: monochromatic,
341
+ accent: accent[1],
342
+ };
343
+ }
344
+ ```
345
+
346
+ ### Format Converter
347
+
348
+ ```typescript
349
+ async function normalizeColors(colors) {
350
+ const normalized = [];
351
+ for (const color of colors) {
352
+ const hex = await convertColor(color, "hex");
353
+ const rgb = await convertColor(color, "rgb");
354
+ const hsl = await convertColor(color, "hsl");
355
+ normalized.push({ original: color, hex, rgb, hsl });
356
+ }
357
+ return normalized;
358
+ }
359
+ ```
360
+
361
+ ## Best Practices
362
+
363
+ 1. **Use deltaE2000** for most perceptual comparisons
364
+ 2. **Always check contrast** for text/background combinations
365
+ 3. **Convert to HCT or LAB** before perceptual operations
366
+ 4. **Use monochromatic palettes** for consistent UI elements
367
+ 5. **Validate accessibility** early in design process
368
+
369
+ ## Related Documentation
370
+
371
+ - [HCT Color Space](../concepts/hct-color-space.md)
372
+ - [Distance Metrics](../concepts/distance-metrics.md)
373
+ - [Accessibility Compliance](../examples/accessibility-compliance.md)
374
+ - [API Reference](../api/README.md#color-operations)