@trishchuk/coolors-mcp 1.0.0 → 1.1.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 (140) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +20 -8
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +22 -8
  3. package/.github/pull_request_template.md +33 -8
  4. package/.github/workflows/ci.yml +107 -104
  5. package/.github/workflows/deploy-docs.yml +14 -11
  6. package/.github/workflows/release.yml +25 -23
  7. package/README.md +149 -15
  8. package/dist/bin/server.js +997 -256
  9. package/dist/bin/server.js.map +1 -1
  10. package/dist/{chunk-P3ARRKLS.js → chunk-HOMDMKUY.js} +3 -1
  11. package/dist/{chunk-P3ARRKLS.js.map → chunk-HOMDMKUY.js.map} +1 -1
  12. package/dist/{chunk-IQ7NN26V.js → chunk-LHW2ZTOU.js} +14 -2
  13. package/dist/chunk-LHW2ZTOU.js.map +1 -0
  14. package/dist/color/index.js +1 -1
  15. package/dist/coolors-mcp.d.ts +4 -4
  16. package/dist/coolors-mcp.js +1 -1
  17. package/docs/.vitepress/components/ClientGrid.vue +9 -3
  18. package/docs/.vitepress/components/CodeBlock.vue +51 -44
  19. package/docs/.vitepress/components/ConfigModal.vue +151 -67
  20. package/docs/.vitepress/components/DiagramModal.vue +186 -154
  21. package/docs/.vitepress/components/TroubleshootingModal.vue +101 -96
  22. package/docs/.vitepress/config.js +171 -141
  23. package/docs/.vitepress/theme/FundingLayout.vue +65 -54
  24. package/docs/.vitepress/theme/Layout.vue +21 -21
  25. package/docs/.vitepress/theme/components/AdBanner.vue +73 -52
  26. package/docs/.vitepress/theme/components/AdPlaceholder.vue +3 -3
  27. package/docs/.vitepress/theme/components/FundingEffects.vue +77 -53
  28. package/docs/.vitepress/theme/components/FundingHero.vue +78 -63
  29. package/docs/.vitepress/theme/components/SupportSection.vue +106 -89
  30. package/docs/.vitepress/theme/custom-app.css +19 -12
  31. package/docs/.vitepress/theme/custom.css +33 -25
  32. package/docs/.vitepress/theme/index.js +19 -16
  33. package/docs/concepts/accessibility.md +59 -47
  34. package/docs/concepts/color-spaces.md +28 -6
  35. package/docs/concepts/distance-metrics.md +45 -30
  36. package/docs/concepts/hct.md +30 -27
  37. package/docs/concepts/image-analysis.md +52 -21
  38. package/docs/concepts/material-design.md +43 -17
  39. package/docs/concepts/theme-matching.md +64 -40
  40. package/docs/examples/basic-colors.md +92 -108
  41. package/docs/examples/creating-themes.md +104 -108
  42. package/docs/examples/css-refactoring.md +33 -29
  43. package/docs/examples/image-extraction.md +145 -138
  44. package/docs/getting-started.md +45 -34
  45. package/docs/index.md +5 -1
  46. package/docs/installation.md +15 -1
  47. package/docs/tools/accessibility.md +74 -68
  48. package/docs/tools/image-extraction.md +62 -54
  49. package/docs/tools/theme-matching.md +45 -42
  50. package/eslint.config.ts +13 -0
  51. package/jsr.json +1 -1
  52. package/package.json +17 -13
  53. package/src/bin/server.ts +13 -1
  54. package/src/color/__tests__/extract-colors.test.ts +20 -30
  55. package/src/color/apca.ts +105 -0
  56. package/src/color/color-blindness.ts +109 -0
  57. package/src/coolors-mcp.ts +1 -1
  58. package/src/session.ts +10 -2
  59. package/src/theme/matcher.ts +1 -1
  60. package/src/theme/refactor.ts +1 -1
  61. package/src/theme/types.ts +3 -0
  62. package/src/tools/__tests__/cohesion.test.ts +97 -0
  63. package/src/tools/__tests__/color-blindness.test.ts +45 -0
  64. package/src/tools/__tests__/color-conversion.test.ts +38 -0
  65. package/src/tools/__tests__/contrast-checker.test.ts +56 -0
  66. package/src/tools/__tests__/palette-export.test.ts +54 -0
  67. package/src/tools/adjust-color.tool.ts +80 -0
  68. package/src/tools/cohesion.tools.ts +380 -0
  69. package/src/tools/color-blindness.tool.ts +168 -0
  70. package/src/tools/color-conversion.tool.ts +1 -1
  71. package/src/tools/contrast-checker.tool.ts +53 -14
  72. package/src/tools/dislike-analyzer.tool.ts +41 -54
  73. package/src/tools/image-extraction.tools.ts +62 -115
  74. package/src/tools/index.ts +15 -2
  75. package/src/tools/palette-export.tool.ts +174 -0
  76. package/src/tools/palette-with-locks.tool.ts +8 -6
  77. package/src/types.ts +2 -3
  78. package/tsconfig.json +12 -2
  79. package/vitest.config.js +1 -3
  80. package/.claude/settings.local.json +0 -39
  81. package/.env +0 -2
  82. package/.mcp.json +0 -12
  83. package/CLAUDE.md +0 -201
  84. package/DOCUMENTATION.md +0 -274
  85. package/GEMINI.md +0 -54
  86. package/demo/content_based_color.png +0 -0
  87. package/demo/music-player.html +0 -621
  88. package/demo/podcast-player.html +0 -903
  89. package/dist/chunk-IQ7NN26V.js.map +0 -1
  90. package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +0 -93
  91. package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js.map +0 -7
  92. package/docs/.vitepress/cache/deps/_metadata.json +0 -127
  93. package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +0 -9
  94. package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +0 -7
  95. package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +0 -12683
  96. package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js.map +0 -7
  97. package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +0 -9719
  98. package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js.map +0 -7
  99. package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +0 -4710
  100. package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +0 -7
  101. package/docs/.vitepress/cache/deps/cytoscape.js +0 -30278
  102. package/docs/.vitepress/cache/deps/cytoscape.js.map +0 -7
  103. package/docs/.vitepress/cache/deps/dayjs.js +0 -285
  104. package/docs/.vitepress/cache/deps/dayjs.js.map +0 -7
  105. package/docs/.vitepress/cache/deps/debug.js +0 -468
  106. package/docs/.vitepress/cache/deps/debug.js.map +0 -7
  107. package/docs/.vitepress/cache/deps/package.json +0 -3
  108. package/docs/.vitepress/cache/deps/prismjs.js +0 -1466
  109. package/docs/.vitepress/cache/deps/prismjs.js.map +0 -7
  110. package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +0 -228
  111. package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js.map +0 -7
  112. package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +0 -142
  113. package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js.map +0 -7
  114. package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +0 -27
  115. package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js.map +0 -7
  116. package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +0 -65
  117. package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js.map +0 -7
  118. package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +0 -53
  119. package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js.map +0 -7
  120. package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +0 -73
  121. package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js.map +0 -7
  122. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4507
  123. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  124. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -584
  125. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  126. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +0 -1146
  127. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +0 -7
  128. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +0 -1667
  129. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +0 -7
  130. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +0 -1814
  131. package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +0 -7
  132. package/docs/.vitepress/cache/deps/vue.js +0 -344
  133. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  134. package/examples/theme-matching.md +0 -113
  135. package/mcp-config.json +0 -8
  136. package/note.md +0 -35
  137. package/research_results.md +0 -53
  138. package/src/tools/colors.ts +0 -31
  139. package/src/tools/registry.ts +0 -142
  140. package/src/tools/simple-tools.ts +0 -37
@@ -10,7 +10,7 @@ Replace a single hardcoded color with a theme variable:
10
10
 
11
11
  ```javascript
12
12
  // Find matching theme variable
13
- "What theme variable matches #6366f1?"
13
+ "What theme variable matches #6366f1?";
14
14
 
15
15
  // With theme CSS
16
16
  const theme = `
@@ -323,8 +323,8 @@ const theme = `
323
323
  { color: "#6366f1", match: "--primary", confidence: 100 },
324
324
  { color: "#ec4899", match: "--accent", confidence: 100 },
325
325
  { color: "#10b981", match: "--success", confidence: 100 },
326
- { color: "#f59e0b", match: "--warning", confidence: 100 }
327
- ]
326
+ { color: "#f59e0b", match: "--warning", confidence: 100 },
327
+ ];
328
328
  ```
329
329
 
330
330
  ## Migration Strategies
@@ -350,15 +350,15 @@ Migrate large codebases incrementally:
350
350
 
351
351
  ```javascript
352
352
  // 1. Start with utility classes
353
- refactorFile('styles/utilities.css', theme);
353
+ refactorFile("styles/utilities.css", theme);
354
354
 
355
355
  // 2. Then base components
356
- refactorFile('styles/buttons.css', theme);
357
- refactorFile('styles/forms.css', theme);
356
+ refactorFile("styles/buttons.css", theme);
357
+ refactorFile("styles/forms.css", theme);
358
358
 
359
359
  // 3. Finally, complex components
360
- refactorFile('styles/navigation.css', theme);
361
- refactorFile('styles/modals.css', theme);
360
+ refactorFile("styles/navigation.css", theme);
361
+ refactorFile("styles/modals.css", theme);
362
362
  ```
363
363
 
364
364
  ### Creating Missing Variables
@@ -369,7 +369,7 @@ When colors don't match existing theme:
369
369
  // Identify unmatched colors
370
370
  const unmatched = [
371
371
  { color: "#7c3aed", usage: ["buttons", "links"] },
372
- { color: "#0ea5e9", usage: ["alerts", "badges"] }
372
+ { color: "#0ea5e9", usage: ["alerts", "badges"] },
373
373
  ];
374
374
 
375
375
  // Generate appropriate variables
@@ -408,13 +408,13 @@ The refactoring tool understands context:
408
408
 
409
409
  Understanding match confidence:
410
410
 
411
- | Confidence | Meaning | Action |
412
- |------------|---------|--------|
413
- | 100% | Exact match | Auto-replace |
414
- | 95-99% | Very close (ΔE < 2) | Auto-replace with comment |
415
- | 85-94% | Close (ΔE < 5) | Suggest replacement |
416
- | 70-84% | Similar (ΔE < 10) | Manual review |
417
- | <70% | Different | Keep original |
411
+ | Confidence | Meaning | Action |
412
+ | ---------- | ------------------- | ------------------------- |
413
+ | 100% | Exact match | Auto-replace |
414
+ | 95-99% | Very close (ΔE < 2) | Auto-replace with comment |
415
+ | 85-94% | Close (ΔE < 5) | Suggest replacement |
416
+ | 70-84% | Similar (ΔE < 10) | Manual review |
417
+ | <70% | Different | Keep original |
418
418
 
419
419
  ### Handling Edge Cases
420
420
 
@@ -632,21 +632,21 @@ Understanding match confidence:
632
632
 
633
633
  ```javascript
634
634
  // refactor-project.js
635
- const { refactorCSS, generateReport } = require('coolors-mcp');
636
- const fs = require('fs');
637
- const path = require('path');
635
+ const { refactorCSS, generateReport } = require("coolors-mcp");
636
+ const fs = require("fs");
637
+ const path = require("path");
638
638
 
639
639
  async function refactorProject(srcDir, themeFile) {
640
- const theme = fs.readFileSync(themeFile, 'utf-8');
640
+ const theme = fs.readFileSync(themeFile, "utf-8");
641
641
  const cssFiles = findCSSFiles(srcDir);
642
642
  const results = [];
643
643
 
644
644
  for (const file of cssFiles) {
645
- const original = fs.readFileSync(file, 'utf-8');
645
+ const original = fs.readFileSync(file, "utf-8");
646
646
  const refactored = await refactorCSS(original, theme, {
647
647
  minConfidence: 85,
648
648
  preserveOriginal: true,
649
- generateReport: true
649
+ generateReport: true,
650
650
  });
651
651
 
652
652
  // Backup original
@@ -658,7 +658,7 @@ async function refactorProject(srcDir, themeFile) {
658
658
  results.push({
659
659
  file,
660
660
  changes: refactored.changes.length,
661
- confidence: refactored.averageConfidence
661
+ confidence: refactored.averageConfidence,
662
662
  });
663
663
  }
664
664
 
@@ -752,12 +752,12 @@ Always verify visual appearance after refactoring:
752
752
  // Visual regression test
753
753
  const screenshots = {
754
754
  before: captureScreenshots(originalCSS),
755
- after: captureScreenshots(refactoredCSS)
755
+ after: captureScreenshots(refactoredCSS),
756
756
  };
757
757
 
758
758
  const differences = compareScreenshots(screenshots);
759
759
  if (differences.length > 0) {
760
- console.warn('Visual differences detected:', differences);
760
+ console.warn("Visual differences detected:", differences);
761
761
  }
762
762
  ```
763
763
 
@@ -774,9 +774,9 @@ Include documentation with your theme variables:
774
774
  --color-on-primary: #ffffff;
775
775
 
776
776
  /* Surface colors - ordered by elevation */
777
- --color-surface-0: #ffffff; /* Base level */
778
- --color-surface-1: #fafafa; /* Slightly elevated */
779
- --color-surface-2: #f5f5f5; /* More elevated */
777
+ --color-surface-0: #ffffff; /* Base level */
778
+ --color-surface-1: #fafafa; /* Slightly elevated */
779
+ --color-surface-2: #f5f5f5; /* More elevated */
780
780
  }
781
781
  ```
782
782
 
@@ -788,6 +788,7 @@ Include documentation with your theme variables:
788
788
 
789
789
  **Problem**: Most matches have <70% confidence
790
790
  **Solution**:
791
+
791
792
  - Check if theme has enough color variations
792
793
  - Consider adding intermediate shades
793
794
  - Use more specific theme variables
@@ -796,6 +797,7 @@ Include documentation with your theme variables:
796
797
 
797
798
  **Problem**: Border colors matching to text variables
798
799
  **Solution**:
800
+
799
801
  - Use clearer variable naming conventions
800
802
  - Provide context parameter when matching
801
803
  - Create role-specific variables
@@ -804,6 +806,7 @@ Include documentation with your theme variables:
804
806
 
805
807
  **Problem**: Slow refactoring for large CSS files
806
808
  **Solution**:
809
+
807
810
  - Split CSS into smaller modules
808
811
  - Process files in parallel
809
812
  - Cache theme parsing results
@@ -812,6 +815,7 @@ Include documentation with your theme variables:
812
815
 
813
816
  **Problem**: Complex gradients not refactoring correctly
814
817
  **Solution**:
818
+
815
819
  - Define gradient variables directly
816
820
  - Use CSS custom properties for gradient stops
817
821
  - Consider keeping complex gradients as-is
@@ -821,4 +825,4 @@ Include documentation with your theme variables:
821
825
  - Learn about [Creating Themes](./creating-themes.md) to build comprehensive design systems
822
826
  - Explore [Image Extraction](./image-extraction.md) for dynamic theme generation
823
827
  - Read [Theme Matching Concepts](../concepts/theme-matching.md) to understand the algorithms
824
- - Check [Material Design Tools](../tools/material-design.md) for advanced theming
828
+ - Check [Material Design Tools](../tools/material-design.md) for advanced theming