@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,716 @@
1
+ /**
2
+ * Color type definitions for various color spaces
3
+ */
4
+ /**
5
+ * Supported color formats for parsing
6
+ */
7
+ declare enum ColorFormat {
8
+ HEX = "hex",
9
+ HSL = "hsl",
10
+ HSV = "hsv",
11
+ LAB = "lab",
12
+ RGB = "rgb",
13
+ XYZ = "xyz"
14
+ }
15
+ /**
16
+ * Options for color distance calculations
17
+ */
18
+ interface ColorDistanceOptions {
19
+ /**
20
+ * Parameters for Delta E 94
21
+ */
22
+ deltaE94?: {
23
+ kC?: number;
24
+ kH?: number;
25
+ kL?: number;
26
+ };
27
+ /**
28
+ * Type of distance metric to use
29
+ */
30
+ metric?: "deltaE2000" | "deltaE76" | "deltaE94" | "euclidean" | "weighted";
31
+ /**
32
+ * Weights for weighted RGB distance
33
+ */
34
+ weights?: {
35
+ b?: number;
36
+ g?: number;
37
+ r?: number;
38
+ };
39
+ }
40
+ /**
41
+ * Color input type that can be parsed
42
+ */
43
+ type ColorInput = HSL | HSV | LAB | RGB | string | XYZ;
44
+ /**
45
+ * HCT (Hue, Chroma, Tone) color representation
46
+ */
47
+ interface HCT$1 {
48
+ c: number;
49
+ h: number;
50
+ t: number;
51
+ }
52
+ /**
53
+ * Hexadecimal color representation
54
+ */
55
+ type HEX = string;
56
+ /**
57
+ * HSL (Hue, Saturation, Lightness) color representation
58
+ * h: [0, 360] degrees
59
+ * s: [0, 100] percentage
60
+ * l: [0, 100] percentage
61
+ */
62
+ interface HSL {
63
+ h: number;
64
+ l: number;
65
+ s: number;
66
+ }
67
+ /**
68
+ * HSV (Hue, Saturation, Value) color representation
69
+ * Also known as HSB (Hue, Saturation, Brightness)
70
+ * h: [0, 360] degrees
71
+ * s: [0, 100] percentage
72
+ * v: [0, 100] percentage
73
+ */
74
+ interface HSV {
75
+ h: number;
76
+ s: number;
77
+ v: number;
78
+ }
79
+ /**
80
+ * LAB color space (CIE L*a*b*)
81
+ * L: [0, 100] lightness
82
+ * a: [-128, 127] green-red axis
83
+ * b: [-128, 127] blue-yellow axis
84
+ */
85
+ interface LAB {
86
+ a: number;
87
+ b: number;
88
+ l: number;
89
+ }
90
+ /**
91
+ * Color parsing result
92
+ */
93
+ interface ParsedColor {
94
+ format: ColorFormat;
95
+ value: HSL | HSV | LAB | RGB | XYZ;
96
+ }
97
+ /**
98
+ * RGB color representation
99
+ * Values should be in range [0, 255]
100
+ */
101
+ interface RGB {
102
+ b: number;
103
+ g: number;
104
+ r: number;
105
+ }
106
+ /**
107
+ * XYZ color space (CIE 1931)
108
+ * Reference white: D65 illuminant
109
+ */
110
+ interface XYZ {
111
+ x: number;
112
+ y: number;
113
+ z: number;
114
+ }
115
+ /**
116
+ * Constants for color space conversions
117
+ */
118
+ declare const ColorConstants: {
119
+ /**
120
+ * D65 illuminant reference white point
121
+ */
122
+ readonly D65: {
123
+ readonly X: 95.047;
124
+ readonly Y: 100;
125
+ readonly Z: 108.883;
126
+ };
127
+ /**
128
+ * Epsilon for LAB conversion
129
+ */
130
+ readonly EPSILON: 0.008856;
131
+ /**
132
+ * Kappa for LAB conversion
133
+ */
134
+ readonly KAPPA: 903.3;
135
+ };
136
+
137
+ /**
138
+ * Color space conversion functions
139
+ */
140
+
141
+ /**
142
+ * Convert ARGB format to RGB
143
+ */
144
+ declare function argbToRgb(argb: number): RGB;
145
+ /**
146
+ * Convert hexadecimal to RGB color
147
+ */
148
+ declare function hexToRgb(hex: HEX): RGB;
149
+ /**
150
+ * Convert HSL to RGB color space
151
+ */
152
+ declare function hslToRgb(hsl: HSL): RGB;
153
+ /**
154
+ * Convert HSV to RGB color space
155
+ */
156
+ declare function hsvToRgb(hsv: HSV): RGB;
157
+ /**
158
+ * Convert LAB to RGB color space
159
+ */
160
+ declare function labToRgb(lab: LAB): RGB;
161
+ /**
162
+ * Convert LAB to XYZ color space
163
+ */
164
+ declare function labToXyz(lab: LAB): XYZ;
165
+ /**
166
+ * Parse color string to RGB
167
+ * Supports: hex (#fff, #ffffff), rgb(r,g,b), hsl(h,s,l)
168
+ */
169
+ declare function parseColor(color: string): null | RGB;
170
+ /**
171
+ * Convert RGB to ARGB format (32-bit integer)
172
+ */
173
+ declare function rgbToArgb(rgb: RGB): number;
174
+ /**
175
+ * Convert RGB to hexadecimal color
176
+ */
177
+ declare function rgbToHex(rgb: RGB): HEX;
178
+ /**
179
+ * Convert RGB to HSL color space
180
+ */
181
+ declare function rgbToHsl(rgb: RGB): HSL;
182
+ /**
183
+ * Convert RGB to HSV color space
184
+ */
185
+ declare function rgbToHsv(rgb: RGB): HSV;
186
+ /**
187
+ * Convert RGB to LAB color space
188
+ */
189
+ declare function rgbToLab(rgb: RGB): LAB;
190
+ /**
191
+ * Convert RGB to XYZ color space
192
+ * Using sRGB working space and D65 illuminant
193
+ */
194
+ declare function rgbToXyz(rgb: RGB): XYZ;
195
+ /**
196
+ * Convert XYZ to LAB color space
197
+ * Using D65 illuminant
198
+ */
199
+ declare function xyzToLab(xyz: XYZ): LAB;
200
+ /**
201
+ * Convert XYZ to RGB color space
202
+ */
203
+ declare function xyzToRgb(xyz: XYZ): RGB;
204
+
205
+ /**
206
+ * HCT Class wrapper for Material Color Utilities compatibility
207
+ */
208
+ /**
209
+ * HCT class compatible with Material Color Utilities
210
+ */
211
+ declare class Hct {
212
+ get chroma(): number;
213
+ /**
214
+ * Set the chroma of this color. Chroma may decrease because chroma has a
215
+ * different maximum for any given hue and tone.
216
+ * @param newChroma 0 <= newChroma < ?
217
+ */
218
+ set chroma(newChroma: number);
219
+ get hue(): number;
220
+ /**
221
+ * Set the hue of this color. Chroma may decrease because chroma has a
222
+ * different maximum for any given hue and tone.
223
+ * @param newHue 0 <= newHue < 360; invalid values are corrected.
224
+ */
225
+ set hue(newHue: number);
226
+ get tone(): number;
227
+ /**
228
+ * Set the tone of this color. Chroma may decrease because chroma has a
229
+ * different maximum for any given hue and tone.
230
+ * @param newTone 0 <= newTone <= 100; invalid values are corrected.
231
+ */
232
+ set tone(newTone: number);
233
+ private _argb;
234
+ private _chroma;
235
+ private _hue;
236
+ private _tone;
237
+ private constructor();
238
+ /**
239
+ * Create an HCT color from hue, chroma, and tone.
240
+ * @param hue 0 <= hue < 360; invalid values are corrected.
241
+ * @param chroma 0 <= chroma < ?; Chroma may decrease because chroma has a
242
+ * different maximum for any given hue and tone.
243
+ * @param tone 0 <= tone <= 100; invalid values are corrected.
244
+ * @return HCT representation of a color in default viewing conditions.
245
+ */
246
+ static from(hue: number, chroma: number, tone: number): Hct;
247
+ /**
248
+ * Create an HCT color from a color.
249
+ * @param argb ARGB representation of a color.
250
+ * @return HCT representation of a color in default viewing conditions
251
+ */
252
+ static fromInt(argb: number): Hct;
253
+ /**
254
+ * @return ARGB representation of an HCT color.
255
+ */
256
+ toInt(): number;
257
+ }
258
+
259
+ /**
260
+ * Check and/or fix universally disliked colors.
261
+ *
262
+ * Color science studies of color preference indicate universal distaste for
263
+ * dark yellow-greens, and also show this is correlated to distaste for
264
+ * biological waste and rotting food.
265
+ *
266
+ * See Palmer and Schloss, 2010 or Schloss and Palmer's Chapter 21 in Handbook
267
+ * of Color Psychology (2015).
268
+ */
269
+ declare class DislikeAnalyzer {
270
+ /**
271
+ * Analyze a batch of colors and return statistics
272
+ * @param colors Array of HCT colors
273
+ * @return Statistics about disliked colors
274
+ */
275
+ static analyzeBatch(colors: Hct[]): {
276
+ disliked: number;
277
+ dislikedIndices: number[];
278
+ percentage: number;
279
+ total: number;
280
+ };
281
+ /**
282
+ * Fix all disliked colors in a batch
283
+ * @param colors Array of HCT colors
284
+ * @return Array with disliked colors fixed
285
+ */
286
+ static fixBatch(colors: Hct[]): Hct[];
287
+ /**
288
+ * If a color is disliked, lighten it to make it likable.
289
+ *
290
+ * @param hct A color to be judged.
291
+ * @return A new color if the original color is disliked, or the original
292
+ * color if it is acceptable.
293
+ */
294
+ static fixIfDisliked(hct: Hct): Hct;
295
+ /**
296
+ * Fix a hex color if it's disliked
297
+ * @param hex Hex color string
298
+ * @return Fixed hex color or original if not disliked
299
+ */
300
+ static fixIfDislikedHex(hex: string): string;
301
+ /**
302
+ * Returns true if a color is disliked.
303
+ *
304
+ * @param hct A color to be judged.
305
+ * @return Whether the color is disliked.
306
+ *
307
+ * Disliked is defined as a dark yellow-green that is not neutral.
308
+ * Specifically: hue 90-111°, chroma > 16, tone < 65
309
+ */
310
+ static isDisliked(hct: Hct): boolean;
311
+ /**
312
+ * Check if a color is in the "bile zone" - universally disliked colors
313
+ * @param hex Hex color string
314
+ * @return Whether the color is disliked
315
+ */
316
+ static isDislikedHex(hex: string): boolean;
317
+ }
318
+
319
+ /**
320
+ * Color Harmonization
321
+ * Algorithms to blend and harmonize colors based on Material Design principles
322
+ */
323
+
324
+ /**
325
+ * Temperature-based color adjustment
326
+ * Warmer (positive) or cooler (negative) adjustment
327
+ */
328
+ declare function adjustTemperature(color: RGB, amount: number): RGB;
329
+ /**
330
+ * Find analogous colors (adjacent on color wheel)
331
+ */
332
+ declare function analogous(color: RGB, angle?: number, count?: number): RGB[];
333
+ /**
334
+ * Blend two colors in HCT space
335
+ * More perceptually uniform than RGB blending
336
+ */
337
+ declare function blend(from: RGB, to: RGB, amount: number): RGB;
338
+ /**
339
+ * Create a double complementary (rectangle) scheme
340
+ */
341
+ declare function doubleComplementary(color1: RGB, color2: RGB): [RGB, RGB, RGB, RGB];
342
+ /**
343
+ * Create a gradient between two colors
344
+ */
345
+ declare function gradient(from: RGB, to: RGB, steps: number): RGB[];
346
+ /**
347
+ * Harmonize a color with a target, making them work better together
348
+ * Based on Material's blend algorithm
349
+ */
350
+ declare function harmonize(design: RGB, source: RGB, factor?: number): RGB;
351
+ /**
352
+ * Find split-complementary colors
353
+ */
354
+ declare function splitComplementary(color: RGB, angle?: number): [RGB, RGB, RGB];
355
+ /**
356
+ * Find tetradic (square) colors - four colors evenly spaced
357
+ */
358
+ declare function tetradic(color: RGB): [RGB, RGB, RGB, RGB];
359
+
360
+ /**
361
+ * HCT (Hue, Chroma, Tone) color space types
362
+ * Based on Material Color Utilities
363
+ */
364
+ /**
365
+ * CAM16 color appearance model
366
+ * Predicts color appearance under different viewing conditions
367
+ */
368
+ interface CAM16 {
369
+ /** Chroma composition */
370
+ astar: number;
371
+ /** Brightness composition */
372
+ bstar: number;
373
+ /** Chroma */
374
+ chroma: number;
375
+ /** Hue angle */
376
+ hue: number;
377
+ /** Lightness */
378
+ j: number;
379
+ /** Hue composition */
380
+ jstar: number;
381
+ /** Colorfulness */
382
+ m: number;
383
+ /** Brightness */
384
+ q: number;
385
+ /** Saturation */
386
+ s: number;
387
+ }
388
+ /**
389
+ * HCT color representation
390
+ * A perceptually accurate color space that combines:
391
+ * - Hue from CAM16
392
+ * - Chroma from CAM16
393
+ * - Tone (Lightness) from L* (LAB)
394
+ */
395
+ interface HCT {
396
+ /** Chroma (colorfulness) [0, ~150] - actual max varies by hue and tone */
397
+ c: number;
398
+ /** Hue angle in degrees [0, 360) */
399
+ h: number;
400
+ /** Tone (lightness) [0, 100] */
401
+ t: number;
402
+ }
403
+ /**
404
+ * Viewing conditions for CAM16
405
+ * Describes the environment in which colors are viewed
406
+ */
407
+ interface ViewingConditions {
408
+ /** Background luminance ratio */
409
+ aw: number;
410
+ /** Base exponential nonlinearity */
411
+ c: number;
412
+ /** Degree of adaptation */
413
+ fl: number;
414
+ /** Luminance level adaptation factor */
415
+ flRoot: number;
416
+ /** Adapting luminance */
417
+ n: number;
418
+ /** Luminance level adaptation factor */
419
+ nbb: number;
420
+ /** Chromatic induction factor */
421
+ nc: number;
422
+ /** Chromatic induction factor */
423
+ ncb: number;
424
+ /** Achromatic response for white */
425
+ rgbD: [number, number, number];
426
+ /** Surround factor */
427
+ z: number;
428
+ }
429
+ /**
430
+ * Standard viewing conditions
431
+ */
432
+ declare const STANDARD_CONDITIONS: ViewingConditions;
433
+
434
+ /**
435
+ * HCT Solver - Converts between HCT and RGB color spaces
436
+ * Based on Material Color Utilities algorithms
437
+ */
438
+
439
+ /**
440
+ * Create an HCT color from components
441
+ */
442
+ declare function hct(hue: number, chroma: number, tone: number): HCT;
443
+ /**
444
+ * Convert HCT to RGB using iterative solving
445
+ * This is a simplified version of Material's HCT solver
446
+ */
447
+ declare function hctToRgb(hct: HCT): RGB;
448
+ /**
449
+ * Get maximum chroma for a given hue and tone
450
+ * This is an approximation - actual max varies
451
+ */
452
+ declare function maxChroma(hue: number, tone: number): number;
453
+ /**
454
+ * Convert RGB to HCT
455
+ */
456
+ declare function rgbToHct(rgb: RGB): HCT;
457
+
458
+ /**
459
+ * Tonal Palette Generator
460
+ * Creates Material Design 3 tonal palettes from HCT colors
461
+ */
462
+
463
+ /**
464
+ * Standard Material 3 tone values
465
+ */
466
+ declare const MATERIAL_TONES: readonly [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 100];
467
+ /**
468
+ * Extended tone values for more granularity
469
+ */
470
+ declare const EXTENDED_TONES: readonly [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 92, 94, 96, 98, 99, 100];
471
+ /**
472
+ * Material 3 Core Palette
473
+ * Contains all the tonal palettes needed for a complete theme
474
+ */
475
+ interface CorePalette {
476
+ /** Error color palette */
477
+ error: TonalPalette;
478
+ /** Neutral color palette (grays) */
479
+ neutral: TonalPalette;
480
+ /** Neutral variant palette (slightly tinted grays) */
481
+ neutralVariant: TonalPalette;
482
+ /** Primary color palette */
483
+ primary: TonalPalette;
484
+ /** Secondary color palette */
485
+ secondary: TonalPalette;
486
+ /** Tertiary color palette */
487
+ tertiary: TonalPalette;
488
+ }
489
+ /**
490
+ * A tonal palette - variations of a single color at different tones
491
+ */
492
+ declare class TonalPalette {
493
+ readonly hue: number;
494
+ readonly chroma: number;
495
+ /**
496
+ * Get extended tones for more options
497
+ */
498
+ get extendedTones(): Record<number, RGB>;
499
+ /**
500
+ * Get all Material 3 standard tones
501
+ */
502
+ get materialTones(): Record<number, RGB>;
503
+ private cache;
504
+ constructor(hue: number, chroma: number);
505
+ /**
506
+ * Create a tonal palette from an HCT color
507
+ */
508
+ static fromHct(color: HCT): TonalPalette;
509
+ /**
510
+ * Create a tonal palette from an RGB color
511
+ */
512
+ static fromRgb(rgb: RGB): TonalPalette;
513
+ /**
514
+ * Get the color at a specific tone
515
+ */
516
+ tone(tone: number): RGB;
517
+ }
518
+ /**
519
+ * Generate an analogous palette (adjacent hues)
520
+ */
521
+ declare function analogousPalette(source: RGB, count?: number, hueShift?: number): TonalPalette[];
522
+ /**
523
+ * Generate a complementary palette
524
+ */
525
+ declare function complementaryPalette(source: RGB): [TonalPalette, TonalPalette];
526
+ /**
527
+ * Generate a complete Material 3 core palette from a source color
528
+ */
529
+ declare function corePaletteFromRgb(source: RGB): CorePalette;
530
+ /**
531
+ * Generate a monochromatic palette (single hue, varying tones)
532
+ */
533
+ declare function monochromaticPalette(source: RGB, tones?: readonly number[]): RGB[];
534
+ /**
535
+ * Generate a triadic palette (three colors evenly spaced)
536
+ */
537
+ declare function triadicPalette(source: RGB): [TonalPalette, TonalPalette, TonalPalette];
538
+
539
+ /**
540
+ * Color distance metrics for calculating perceptual differences between colors
541
+ */
542
+
543
+ /**
544
+ * Determine if two colors are perceptually similar
545
+ * Uses Delta E 2000 with a threshold
546
+ */
547
+ declare function areColorsSimilar(color1: RGB, color2: RGB, threshold?: number): boolean;
548
+ /**
549
+ * Calculate color distance between two RGB colors using specified metric
550
+ */
551
+ declare function colorDistance(color1: RGB, color2: RGB, options?: ColorDistanceOptions): number;
552
+ /**
553
+ * Calculate Delta E CIE2000 (ΔE*00)
554
+ * Most accurate perceptual color difference formula
555
+ */
556
+ declare function deltaE2000(lab1: LAB, lab2: LAB): number;
557
+ /**
558
+ * Calculate Delta E CIE76 (ΔE*ab)
559
+ * Original CIE color difference formula
560
+ */
561
+ declare function deltaE76(lab1: LAB, lab2: LAB): number;
562
+ /**
563
+ * Calculate Delta E CIE94 (ΔE*94)
564
+ * Improved perceptual uniformity over CIE76
565
+ */
566
+ declare function deltaE94(lab1: LAB, lab2: LAB, options?: {
567
+ kC?: number;
568
+ kH?: number;
569
+ kL?: number;
570
+ }): number;
571
+ /**
572
+ * Calculate Euclidean distance between two RGB colors
573
+ * Simple but not perceptually uniform
574
+ */
575
+ declare function euclideanDistance(color1: RGB, color2: RGB): number;
576
+ /**
577
+ * Find the most different color from a set of colors
578
+ */
579
+ declare function findMostDifferentColor(baseColor: RGB, colors: RGB[], options?: ColorDistanceOptions): null | RGB;
580
+ /**
581
+ * Find the most similar color from a set of colors
582
+ */
583
+ declare function findMostSimilarColor(baseColor: RGB, colors: RGB[], options?: ColorDistanceOptions): null | RGB;
584
+ /**
585
+ * Calculate weighted RGB distance
586
+ * Better approximation of perceptual difference than simple Euclidean
587
+ */
588
+ declare function weightedRgbDistance(color1: RGB, color2: RGB, weights?: {
589
+ b?: number;
590
+ g?: number;
591
+ r?: number;
592
+ }): number;
593
+
594
+ /**
595
+ * Utility functions for color manipulation and validation
596
+ */
597
+
598
+ /**
599
+ * Clamp HSL values to valid range
600
+ */
601
+ declare function clampHsl(hsl: HSL): HSL;
602
+ /**
603
+ * Clamp HSV values to valid range
604
+ */
605
+ declare function clampHsv(hsv: HSV): HSV;
606
+ /**
607
+ * Clamp RGB values to valid range
608
+ */
609
+ declare function clampRgb(rgb: RGB): RGB;
610
+ /**
611
+ * Darken a color by a percentage
612
+ * @param rgb The color to darken
613
+ * @param amount Amount to darken (0-100)
614
+ */
615
+ declare function darken(rgb: RGB, amount: number): RGB;
616
+ /**
617
+ * Desaturate a color by a percentage
618
+ * @param rgb The color to desaturate
619
+ * @param amount Amount to desaturate (0-100)
620
+ */
621
+ declare function desaturate(rgb: RGB, amount: number): RGB;
622
+ /**
623
+ * Format color to various string representations
624
+ */
625
+ declare function formatColor(rgb: RGB, format?: "hex" | "hsl" | "hsv" | "rgb"): string;
626
+ /**
627
+ * Format HSL color to string
628
+ */
629
+ declare function formatHsl(hsl: HSL, alpha?: number): string;
630
+ /**
631
+ * Format RGB color to string
632
+ */
633
+ declare function formatRgb(rgb: RGB, alpha?: number): string;
634
+ /**
635
+ * Get complementary color (opposite on color wheel)
636
+ */
637
+ declare function getComplementary(rgb: RGB): RGB;
638
+ /**
639
+ * Calculate contrast ratio between two colors
640
+ * Based on WCAG 2.0 formula
641
+ */
642
+ declare function getContrastRatio(color1: RGB, color2: RGB): number;
643
+ /**
644
+ * Calculate relative luminance of an RGB color
645
+ * Based on WCAG 2.0 formula
646
+ */
647
+ declare function getLuminance(rgb: RGB): number;
648
+ /**
649
+ * Invert a color
650
+ */
651
+ declare function invertColor(rgb: RGB): RGB;
652
+ /**
653
+ * Check if a color is considered "dark"
654
+ * Based on luminance threshold
655
+ */
656
+ declare function isDark(rgb: RGB, threshold?: number): boolean;
657
+ /**
658
+ * Check if a color is considered "light"
659
+ * Based on luminance threshold
660
+ */
661
+ declare function isLight(rgb: RGB, threshold?: number): boolean;
662
+ /**
663
+ * Validate hexadecimal color string
664
+ */
665
+ declare function isValidHex(hex: string): boolean;
666
+ /**
667
+ * Validate HSL color values
668
+ */
669
+ declare function isValidHsl(hsl: HSL): boolean;
670
+ /**
671
+ * Validate HSV color values
672
+ */
673
+ declare function isValidHsv(hsv: HSV): boolean;
674
+ /**
675
+ * Validate RGB color values
676
+ */
677
+ declare function isValidRgb(rgb: RGB): boolean;
678
+ /**
679
+ * Lighten a color by a percentage
680
+ * @param rgb The color to lighten
681
+ * @param amount Amount to lighten (0-100)
682
+ */
683
+ declare function lighten(rgb: RGB, amount: number): RGB;
684
+ /**
685
+ * Check if contrast meets WCAG AA standard
686
+ * Normal text: 4.5:1, Large text: 3:1
687
+ */
688
+ declare function meetsContrastAA(color1: RGB, color2: RGB, largeText?: boolean): boolean;
689
+ /**
690
+ * Check if contrast meets WCAG AAA standard
691
+ * Normal text: 7:1, Large text: 4.5:1
692
+ */
693
+ declare function meetsContrastAAA(color1: RGB, color2: RGB, largeText?: boolean): boolean;
694
+ /**
695
+ * Mix two colors together
696
+ * @param color1 First color
697
+ * @param color2 Second color
698
+ * @param weight Weight of the first color (0-1)
699
+ */
700
+ declare function mixColors(color1: RGB, color2: RGB, weight?: number): RGB;
701
+ /**
702
+ * Generate a random RGB color
703
+ */
704
+ declare function randomColor(): RGB;
705
+ /**
706
+ * Saturate a color by a percentage
707
+ * @param rgb The color to saturate
708
+ * @param amount Amount to saturate (0-100)
709
+ */
710
+ declare function saturate(rgb: RGB, amount: number): RGB;
711
+ /**
712
+ * Convert color to grayscale
713
+ */
714
+ declare function toGrayscale(rgb: RGB): RGB;
715
+
716
+ export { type CAM16, ColorConstants, type ColorDistanceOptions, ColorFormat, type ColorInput, type CorePalette, DislikeAnalyzer, EXTENDED_TONES, type HCT$1 as HCT, type HEX, type HSL, type HSV, Hct, type LAB, MATERIAL_TONES, type ParsedColor, type RGB, STANDARD_CONDITIONS, TonalPalette, type ViewingConditions, type XYZ, adjustTemperature, analogous, analogousPalette, areColorsSimilar, argbToRgb, blend, clampHsl, clampHsv, clampRgb, colorDistance, complementaryPalette, corePaletteFromRgb, darken, deltaE2000, deltaE76, deltaE94, desaturate, doubleComplementary, euclideanDistance, findMostDifferentColor, findMostSimilarColor, formatColor, formatHsl, formatRgb, getComplementary, getContrastRatio, getLuminance, gradient, harmonize, hct, hctToRgb, hexToRgb, hslToRgb, hsvToRgb, invertColor, isDark, isLight, isValidHex, isValidHsl, isValidHsv, isValidRgb, labToRgb, labToXyz, lighten, maxChroma, meetsContrastAA, meetsContrastAAA, mixColors, monochromaticPalette, parseColor, randomColor, rgbToArgb, rgbToHct, rgbToHex, rgbToHsl, rgbToHsv, rgbToLab, rgbToXyz, saturate, splitComplementary, tetradic, toGrayscale, triadicPalette, weightedRgbDistance, xyzToLab, xyzToRgb };